mfgtools
mfgtools copied to clipboard
undefined reference to `__atomic_load_8' on Raspberry Pi
I tried compiling the latest released version on Raspberry Pi, but it failed to link
usbhotplug.cpp:(.text+0x568): undefined reference to `__atomic_load_8'
/usr/bin/ld: ../libuuu/libuuc_s.a(usbhotplug.cpp.o): in function `check_usb_timeout(Timer&)':
usbhotplug.cpp:(.text+0xf18): undefined reference to `__atomic_load_8'
/usr/bin/ld: usbhotplug.cpp:(.text+0xf38): undefined reference to `__atomic_load_8'
/usr/bin/ld: usbhotplug.cpp:(.text+0x1078): undefined reference to `__atomic_load_8'
/usr/bin/ld: ../libuuu/libuuc_s.a(usbhotplug.cpp.o): in function `polling_usb(std::atomic<int>&)':
usbhotplug.cpp:(.text+0x113c): undefined reference to `__atomic_load_8'
collect2: error: ld returned 1 exit status
make[2]: *** [uuu/CMakeFiles/uuu.dir/build.make:162: uuu/uuu] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: uuu/CMakeFiles/uuu.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
It seems to be an issue with the CMake config also reported elsewhere: https://github.com/alexa/avs-device-sdk/issues/380
g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 8.3.0-6+rpi1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)
It seems that adding the following to the root CMake.txt fixes the issue
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic")
Maybe your G++ is old. I think no harm to add -latomic. You can send pull request to me