Building RRFlibraries 'atomic_uint8_t' does not name a type



  • Trying to set up Eclipse to build the firmware and hit a snag that I can't seem to iron out.

    I've checked out the following (in git bash, on windows, after giving up on linux linux build works after all, still curious what I messed up here?)

    cd /c/eclipse/firmware
    git clone https://github.com/dc42/CoreNG.git --branch dev
    git clone https://github.com/dc42/CANlib.git
    git clone https://github.com/dc42/RRFLibraries.git --branch dev
    git clone https://github.com/dc42/FreeRTOS.git
    git clone https://github.com/dc42/RepRapFirmware.git --branch v3-dev
    git clone https://github.com/dc42/DuetWiFiSocketServer.git
    

    Screenshot to verify (if I've missed something between juggling versions)
    dc76bdc3-ebc2-4eb3-bbe9-31013dee0f5a-image.png

    It fails with

    01:57:28 **** Clean-only build of configuration SAME70_RTOS for project RRFLibraries ****
    make -j4 clean 
    rm -rf  ./src/RTOSIface/RTOSIface.o  ./src/Math/Isqrt.o  ./src/General/IP4String.o ./src/General/IPAddress.o ./src/General/SafeStrtod.o ./src/General/SafeVsnprintf.o ./src/General/StringFunctions.o ./src/General/StringRef.o ./src/General/Strnlen.o  ./src/RTOSIface/RTOSIface.d  ./src/Math/Isqrt.d  ./src/General/IP4String.d ./src/General/IPAddress.d ./src/General/SafeStrtod.d ./src/General/SafeVsnprintf.d ./src/General/StringFunctions.d ./src/General/StringRef.d ./src/General/Strnlen.d  libRRFLibraries.a
     
    
    01:57:28 Build Finished. 0 errors, 0 warnings. (took 295ms)
    
    01:57:29 **** Incremental Build of configuration SAME70_RTOS for project RRFLibraries ****
    make -j4 all 
    Building file: ../src/RTOSIface/RTOSIface.cpp
    Building file: ../src/Math/Isqrt.cpp
    Building file: ../src/General/IP4String.cpp
    Building file: ../src/General/IPAddress.cpp
    Invoking: Cross G++ Compiler
    Invoking: Cross G++ Compiler
    Invoking: Cross G++ Compiler
    arm-none-eabi-g++ -std=gnu++17 -D__SAME70Q21__ -DRTOS -I"C:\eclipse\firmware\FreeRTOS\src\include" -I"C:\eclipse\firmware\FreeRTOS\src\portable\GCC\ARM_CM7\r0p1" -O3 -Wall -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -mno-unaligned-access -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions -nostdlib -Wundef -Wdouble-promotion -fsingle-precision-constant "-Wa,-ahl=RTOSIface.s" -MMD -MP -MF"src/RTOSIface/RTOSIface.d" -MT"src/RTOSIface/RTOSIface.o" -o "src/RTOSIface/RTOSIface.o" "../src/RTOSIface/RTOSIface.cpp"
    Invoking: Cross G++ Compiler
    arm-none-eabi-g++ -std=gnu++17 -D__SAME70Q21__ -DRTOS -I"C:\eclipse\firmware\FreeRTOS\src\include" -I"C:\eclipse\firmware\FreeRTOS\src\portable\GCC\ARM_CM7\r0p1" -O3 -Wall -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -mno-unaligned-access -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions -nostdlib -Wundef -Wdouble-promotion -fsingle-precision-constant "-Wa,-ahl=Isqrt.s" -MMD -MP -MF"src/Math/Isqrt.d" -MT"src/Math/Isqrt.o" -o "src/Math/Isqrt.o" "../src/Math/Isqrt.cpp"
    arm-none-eabi-g++ -std=gnu++17 -D__SAME70Q21__ -DRTOS -I"C:\eclipse\firmware\FreeRTOS\src\include" -I"C:\eclipse\firmware\FreeRTOS\src\portable\GCC\ARM_CM7\r0p1" -O3 -Wall -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -mno-unaligned-access -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions -nostdlib -Wundef -Wdouble-promotion -fsingle-precision-constant "-Wa,-ahl=IP4String.s" -MMD -MP -MF"src/General/IP4String.d" -MT"src/General/IP4String.o" -o "src/General/IP4String.o" "../src/General/IP4String.cpp"
    arm-none-eabi-g++ -std=gnu++17 -D__SAME70Q21__ -DRTOS -I"C:\eclipse\firmware\FreeRTOS\src\include" -I"C:\eclipse\firmware\FreeRTOS\src\portable\GCC\ARM_CM7\r0p1" -O3 -Wall -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -mno-unaligned-access -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions -nostdlib -Wundef -Wdouble-promotion -fsingle-precision-constant "-Wa,-ahl=IPAddress.s" -MMD -MP -MF"src/General/IPAddress.d" -MT"src/General/IPAddress.o" -o "src/General/IPAddress.o" "../src/General/IPAddress.cpp"
    In file included from ../src/RTOSIface/RTOSIface.cpp:8:0:
    ../src/RTOSIface/RTOSIface.h:352:7: error: 'atomic_uint8_t' in namespace 'std' does not name a type
      std::atomic_uint8_t numReaders;   // MSB is set if a task is writing or write pending, lower bits are the number of readers
           ^~~~~~~~~~~~~~
    ../src/RTOSIface/RTOSIface.h:353:21: error: 'std::atomic_uint8_t' has not been declared
      static_assert(std::atomic_uint8_t::is_always_lock_free);
                         ^~~~~~~~~~~~~~
    ../src/RTOSIface/RTOSIface.h: In constructor 'ReadWriteLock::ReadWriteLock()':
    ../src/RTOSIface/RTOSIface.h:336:5: error: class 'ReadWriteLock' does not have any field named 'numReaders'
       : numReaders(0), writeLockOwner(nullptr)
         ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp: In member function 'void ReadWriteLock::LockForReading()':
    ../src/RTOSIface/RTOSIface.cpp:244:17: error: 'numReaders' was not declared in this scope
        uint8_t nr = numReaders;
                     ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp: In member function 'void ReadWriteLock::ReleaseReader()':
    ../src/RTOSIface/RTOSIface.cpp:269:5: error: 'numReaders' was not declared in this scope
       --numReaders;
         ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp: In member function 'void ReadWriteLock::LockForWriting()':
    ../src/RTOSIface/RTOSIface.cpp:293:16: error: 'numReaders' was not declared in this scope
       uint8_t nr = numReaders;
                    ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp:306:9: error: 'numReaders' was not declared in this scope
      while (numReaders != 0x80)
             ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp: In member function 'void ReadWriteLock::ReleaseWriter()':
    ../src/RTOSIface/RTOSIface.cpp:321:3: error: 'numReaders' was not declared in this scope
       numReaders = 0;
       ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp:323:12: error: 'numReaders' was not declared in this scope
      else if ((numReaders & 0x7F) != 0)
                ^~~~~~~~~~
    ../src/RTOSIface/RTOSIface.cpp: In member function 'void ReadWriteLock::DowngradeWriter()':
    ../src/RTOSIface/RTOSIface.cpp:336:3: error: 'numReaders' was not declared in this scope
       numReaders = 1;
       ^~~~~~~~~~
    Finished building: ../src/General/IPAddress.cpp
    make: *** [src/RTOSIface/subdir.mk:20: src/RTOSIface/RTOSIface.o] Error 1
    make: *** Waiting for unfinished jobs....
    Finished building: ../src/General/IP4String.cpp
     
     
    Finished building: ../src/Math/Isqrt.cpp
     
    
    01:57:30 Build Failed. 12 errors, 0 warnings. (took 1s.58ms)
    
    

    Am I using the wrong branches of something or the wrong tools? GNU Tools ARM Embedded\8 2018-q4-major


  • administrators

    For all targets except SAMC21, type std::atomic_uint8_t should be defined in file <atomic> which is #included at line 24 of RTOSIface.h. On my Windows build system, that file is located in folder C:\Program Files (x86)\GNU Tools ARM Embedded\8 2018-q4-major\arm-none-eabi\include\c++\8.2.1.

    HTH David



  • Thanks, i found the included file and the include statement doesn't throw an error so a little puzzled as to whats wrong. It does build for Duet2RTOS but not Duet3V06.

    No big deal, Kudos to oliof for this thread aiding in getting it built under Debian. Will update thread if I stumble onto the solution for Windows


  • administrators

    @bearer said in Building RRFlibraries 'atomic_uint8_t' does not name a type:

    Will update thread if I stumble onto the solution for Windows

    I build under Windows and I don't have any build problems. Could it be picking up an old include file on your machine?



  • 💡 you sir are a saint and a genius!

    I thought I had removed the old stuff from building PanelDue, but I clearly know far too little about eclipse and cross compiling in general.

    RRF(libraries) built without issues!


Log in to reply