jeudi 7 septembre 2023

Need help resolving linking error for a Yocto recipe

so i have a source package that uses std atomic, and currently i am seeing linker erroers while building, the error i am seeing is

| /opt/workspace/foo/build-sim-debug/tmp/work/core2-64-poky-linux/bar/git-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/ld: src/CMakeFiles/FooImpl.dir/xxx.cpp.o: in function `std::atomic<xxx_handle>::load(std::memory_order) const':
| /usr/include/c++/11.2.0/atomic:285: undefined reference to `__atomic_load_16'
| /opt/workspace/foo/build-sim-debug/tmp/work/core2-64-poky-linux/bar/git-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/ld: src/CMakeFiles/FooImpl.dir/xxx.cpp.o: in function `std::atomic<xxx_handle>::store(xxx_handle, std::memory_order)':
| /usr/include/c++/11.2.0/atomic:271: undefined reference to `__atomic_store_16'
| /opt/workspace/foo/build-sim-debug/tmp/work/core2-64-poky-linux/bar/git-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/ld: /usr/include/c++/11.2.0/atomic:271: undefined reference to `__atomic_store_16'
| /opt/workspace/foo/build-s
[buildfarm-ssh] im-debug/tmp/work/core2-64-poky-linux/bar/git-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/ld: /usr/include/c++/11.2.0/atomic:271: undefined reference to `__atomic_store_16'
| /opt/workspace/foo/build-sim-debug/tmp/work/core2-64-poky-linux/bar/git-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/ld: src/CMakeFiles/FooImpl.dir/xxx.cpp.o: in function `std::atomic<xxx_handle>::load(std::memory_order) const':
| /usr/include/c++/11.2.0/atomic:285: undefined reference to `__atomic_load_16' 

While researching i found this link which does state that for some compilers you need to pass -latomic , my current recipe is like this but i am still seeing the same issue, would greatly appreciate if someone can provide pointers what i might be doing wrong here

SUMMARY = "FooImpl"
DESCRIPTION = "FooImpl Recipe"
LICENSE = "CLOSED"
 
DEPENDS = "fooInterface googletest framework"
 
SRC_URI = "git://FooImpl;protocol=ssh;branch=mainline;"
SRCREV = "yyyy"
 
S = "${WORKDIR}/git"
 
inherit cmake
 
EXTRA_OEMAKE="TARGET_LDFLAGS=' -latomic' \
             "

Please note that i have already tried LDFLAGS += "-latomic" as well, hat did not help, i also see LDFLAGS = "-L ${RECIPE_SYSROOT}" as well in the codebase for some recipes but i am not sure what it does and whether i should do that for this recipe. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire