Message ID | 20231114-rust-with-clang-v1-1-d05ed1f7387c@gmail.com |
---|---|
State | New |
Headers | show |
Series | rust: Avoid removing origin from llvm-config binary with chrpath | expand |
On Tue, 2023-11-14 at 07:29 -0800, Khem Raj wrote: > If these directories are removed from binary, it does not find the > needed libraries it may need from recipe-sysroot-native, e.g. when > building with clang+llvm-runtime, it also builds rust-native with > clang-native and links to libc++.so.1 which will be part of > native sysroot but may not be available on build host system install > and it loses that ability to find it in native sysroot and we see errors > like > llvm-config: libc++.so.1 not found. > > during rust bootstrap execution. > > This patch stops editing the binary, so it can find the dependencies in > native sysroot it > needs for running itself when placed in target directory ( target sysroot ) > yet when llvm-config is invoked the reported paths are relative to > taregt sysroot which is what we expect, so functionality remains as it is. > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > --- > When using libc++ instead of libstdc++, llvm-config is unable to find > libc++.so.1 from native sysroot due to llvm-config copying dance we do. > --- > meta/recipes-devtools/rust/rust_1.70.0.bb | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/meta/recipes-devtools/rust/rust_1.70.0.bb b/meta/recipes-devtools/rust/rust_1.70.0.bb > index 16d433910f8..98cc56c0c91 100644 > --- a/meta/recipes-devtools/rust/rust_1.70.0.bb > +++ b/meta/recipes-devtools/rust/rust_1.70.0.bb > @@ -205,7 +205,6 @@ rust_runx () { > if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} -a ! -f ${RUST_ALTERNATE_EXE_PATH} ]; then > mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` > cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} > - chrpath -d ${RUST_ALTERNATE_EXE_PATH} > fi > > oe_cargo_fix_env > We had to do that since we're moving the binary and the relative paths no longer work? It depends on your layout iirc so some will work, some won't and it sounds like you're just getting lucky :(. Put another way, that was put there for a reason so we can't just remove it. Cheers, Richard
diff --git a/meta/recipes-devtools/rust/rust_1.70.0.bb b/meta/recipes-devtools/rust/rust_1.70.0.bb index 16d433910f8..98cc56c0c91 100644 --- a/meta/recipes-devtools/rust/rust_1.70.0.bb +++ b/meta/recipes-devtools/rust/rust_1.70.0.bb @@ -205,7 +205,6 @@ rust_runx () { if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} -a ! -f ${RUST_ALTERNATE_EXE_PATH} ]; then mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} - chrpath -d ${RUST_ALTERNATE_EXE_PATH} fi oe_cargo_fix_env
If these directories are removed from binary, it does not find the needed libraries it may need from recipe-sysroot-native, e.g. when building with clang+llvm-runtime, it also builds rust-native with clang-native and links to libc++.so.1 which will be part of native sysroot but may not be available on build host system install and it loses that ability to find it in native sysroot and we see errors like llvm-config: libc++.so.1 not found. during rust bootstrap execution. This patch stops editing the binary, so it can find the dependencies in native sysroot it needs for running itself when placed in target directory ( target sysroot ) yet when llvm-config is invoked the reported paths are relative to taregt sysroot which is what we expect, so functionality remains as it is. Signed-off-by: Khem Raj <raj.khem@gmail.com> --- When using libc++ instead of libstdc++, llvm-config is unable to find libc++.so.1 from native sysroot due to llvm-config copying dance we do. --- meta/recipes-devtools/rust/rust_1.70.0.bb | 1 - 1 file changed, 1 deletion(-) --- base-commit: abf3e54d118139e1fcd952a691b77a0c53db6a30 change-id: 20231114-rust-with-clang-21ace8ddf286 Best regards,