Open pberginkonsult opened 2 years ago
This is probably not a meta-clang issue alone. I apologize but forgot one step in the reproducer above which is a patch to relocate ncurses libs in the SDK from /lib
to /usr/lib
.
$ git diff meta/recipes-core/ncurses/ncurses.inc
diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index a0ecd8a80b..4dc02652bf 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -34,6 +34,7 @@ BUILD_CPPFLAGS += "-D_GNU_SOURCE"
# natives don't generally look in base_libdir
base_libdir:class-native = "${libdir}"
+base_libdir:class-nativesdk = "${libdir}"
# Display corruption occurs on 64 bit hosts without these settings
# This was derrived from the upstream debian ncurses which uses
There are some issue with the paths that the linker searches for libraries. Looking in to libclang.so.13.0.1 issue here I have, with help from this thread https://lists.openembedded.org/g/openembedded-core/topic/80874524#148546 , extracted a lot more information with LD_DEBUG=all
. Interesting info related to libclang is this:
20319: file=librt.so.1 [0]; needed by /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/libLLVM-13.so [0]
20319: find library=librt.so.1 [0]; searching
20319: search path=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/..:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/../lib (RPATH from file /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/libLLVM-13.so)
20319: trying file=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/../librt.so.1
20319: trying file=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/../lib/librt.so.1
20319: search path=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/..:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib (RPATH from file /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/libclang.so.13.0.1)
20319: trying file=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../librt.so.1
20319: trying file=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/librt.so.1
20319: search path=/work/tmp/rust-hello/target/debug/deps:/work/tmp/rust-hello/target/debug (LD_LIBRARY_PATH)
20319: trying file=/work/tmp/rust-hello/target/debug/deps/librt.so.1
20319: trying file=/work/tmp/rust-hello/target/debug/librt.so.1
20319: search cache=/etc/ld.so.cache
20319: trying file=/lib/x86_64-linux-gnu/librt.so.1
In the SDK most of the libraries are located in /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib
but also some of them, for example librt.so.1
, are located in /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/lib
. The RPATH of libclang.so.13.0.1
does not include <sysroot>/lib
.
$ /work/yocto/poky/build/tmp/sysroots-uninative/x86_64-linux/usr/bin/patchelf-uninative /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/libclang.so.13.0.1 --print-rpath
$ORIGIN/..:$ORIGIN/../lib
The same seems true for libLLVM (not from this layer):
$ /work/yocto/poky/build/tmp/sysroots-uninative/x86_64-linux/usr/bin/patchelf-uninative /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/libLLVM-13.so --print-rpath
$ORIGIN/..:$ORIGIN/../lib
Should $ORIGIN/../..:$ORIGIN/../../lib
also be added to RPATH?
But there are also more interesting/strange things in the log from LD_DEBUG=all
it reports different RPATH from libclang.so.13.0.1
in different occasions:
<snip>
20319: search path=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../glibc-hwcaps/x86-64-v4:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../glibc-hwcaps/x86-64-v3:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../glibc-hwcaps/x86-64-v2:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/haswell/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/haswell/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/haswell/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/haswell:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../tls:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../haswell/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../haswell/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../haswell/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../haswell:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/..:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/glibc-hwcaps/x86-64-v4:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/glibc-hwcaps/x86-64-v3:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/glibc-hwcaps/x86-64-v2:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/haswell/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/haswell/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/haswell/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/haswell:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/tls:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/haswell/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/haswell/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/haswell/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/haswell:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/avx512_1/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/avx512_1:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib/x86_64:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib (RPATH from file /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/libclang.so.13.0.1)
<snip>
20319: search path=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/..:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib (RPATH from file /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/libclang.so.13.0.1)
<snip>
20319: search path=/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/..:/work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/../lib (RPATH from file /work/sdk/poky-x86/sysroots/x86_64-pokysdk-linux/usr/lib/libclang.so.13.0.1)
<snip>
Are there is some other function tampering with RPATH when using Yocto SDK?
Can you try out https://github.com/kraj/meta-clang/pull/533
Can you try out #533
I have tried #533 and can not see any difference in the dependencies. Have verified that CMAKE_BUILD_WITH_INSTALL_RPATH=ON
is passed in do_configure of libcxx. But I can not find any dependency between nativesdk-clang (providing libclnag.so.13.0.1) and libcxx. Should there be one?
@pberginkonsult it seems specific to rust here. Can you try a simple c/c++ example using CLANGCC and see if that works ok ? if that works then we have the issue in llvm bundled with rust
Describe the bug When adding libclang to SDK and used in a build the dynamic linker will use libc.so.6 from the system instead of the one from the SDK. There can be a version
This is found when trying to build rust code with librocksdb-sys using bindgen. Error from rust:
When running ldd on
libclang.so.13.0.1
and checking versions oflibc.so.6
:To Reproduce
bitbake core-image-minial -cpopulate_sdk
See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] librocksdb-sys = "6.20.3" $ $ cargo build -v --target x86_64-poky-linux