path: root/meta/recipes-devtools
diff options
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-25 14:40:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-26 22:09:25 +0100
commit099c761ffddcc828329d3083cc8f3d24b43e9277 (patch)
treef8e1afc5c857b9d4dcc0204a3bb865059d6850ae /meta/recipes-devtools
parent842cba1820416d79e30e3f1940e2486707fc7cff (diff)
rust: Avoid buildtools+uninative issues with glibc symbols mismatches
If we use an external buildtools tarball, that combined with uninative results in build failures with symbol mismatches. This was tracked down to the prebuilt rust binaries that are downloaded. The libc/loader used to load them is used to execute target binaries/libraries and therefore anything with built with a newer libc would fail. Add code to use patchelf to change the interpreter to our own uninative one if present which ensures the newer libc and loader are used, hence avoiding the issue. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
index 6045ab4d42..dc92cf5fd0 100644
--- a/meta/recipes-devtools/rust/rust.inc
+++ b/meta/recipes-devtools/rust/rust.inc
@@ -50,6 +50,14 @@ do_rust_setup_snapshot () {
# and fail without it there.
mkdir -p ${RUSTSRC}/build/${BUILD_SYS}
ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0
+ # Need to use uninative's loader if enabled/present since the library paths
+ # are used internally by rust and result in symbol mismatches if we don't
+ if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
+ for bin in cargo rustc rustdoc; do
+ patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER}
+ done
+ fi
addtask rust_setup_snapshot after do_unpack before do_configure
do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot"