]> code.ossystems Code Review - openembedded-core.git/commitdiff
rust: Avoid buildtools+uninative issues with glibc symbols mismatches
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 25 Aug 2021 13:40:51 +0000 (14:40 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 26 Aug 2021 21:09:25 +0000 (22:09 +0100)
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>
meta/recipes-devtools/rust/rust.inc

index 6045ab4d42f4ada700041e13b2c41412079887c3..dc92cf5fd002bcb68e0e5ecff208f1b5049ca27e 100644 (file)
@@ -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"