From fe90461e2d79718e449172886df00c72d8e2f0e9 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 25 Aug 2021 14:40:51 +0100 Subject: 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. (From OE-Core rev: 099c761ffddcc828329d3083cc8f3d24b43e9277) Signed-off-by: Richard Purdie --- meta/recipes-devtools/rust/rust.inc | 8 ++++++++ 1 file changed, 8 insertions(+) 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" -- cgit v1.2.3-54-g00ecf