All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] uninative: Upgrade to 3.4
@ 2021-09-01 13:23 Richard Purdie
  2021-09-01 13:23 ` [PATCH 2/2] cargo: Hack around LD_LIBRARY_PATH issues on centos7 Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2021-09-01 13:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: Michael Halstead

From: Michael Halstead <mhalstead@linuxfoundation.org>

This adds a patch to glibc which allows it to work with Docker and
clone3 syscall issues cased by EPERM vs ENOSYS.

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/conf/distro/include/yocto-uninative.inc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/conf/distro/include/yocto-uninative.inc b/meta/conf/distro/include/yocto-uninative.inc
index 76f4cff565d..3165fc93b89 100644
--- a/meta/conf/distro/include/yocto-uninative.inc
+++ b/meta/conf/distro/include/yocto-uninative.inc
@@ -8,7 +8,7 @@
 
 UNINATIVE_MAXGLIBCVERSION = "2.34"
 
-UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/3.3/"
-UNINATIVE_CHECKSUM[aarch64] ?= "372d31264ea7ab8e08e0a9662f003b53e99b3813cc2d9f9a4cc5c2949a1de00b"
-UNINATIVE_CHECKSUM[i686] ?= "36436167eba8a5957a0bf9a32402dd1be8b69528c1ff25e711e6895b583b2b42"
-UNINATIVE_CHECKSUM[x86_64] ?= "92b5e465f74d7e195e0b60fe4146f0f1475fff87ab2649bf2d57a1526ef58aec"
+UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/3.4/"
+UNINATIVE_CHECKSUM[aarch64] ?= "3013cdda8f0dc6639ce1c80f33eabce66f06b890bd5b58739a6d7a92a0bb7100"
+UNINATIVE_CHECKSUM[i686] ?= "abed500de584aad63ec237546db20cdd0c69d8870a6f8e94ac31721ace64b376"
+UNINATIVE_CHECKSUM[x86_64] ?= "126f4f7f6f21084ee140dac3eb4c536b963837826b7c38599db0b512c3377ba2"
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] cargo: Hack around LD_LIBRARY_PATH issues on centos7
  2021-09-01 13:23 [PATCH 1/2] uninative: Upgrade to 3.4 Richard Purdie
@ 2021-09-01 13:23 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2021-09-01 13:23 UTC (permalink / raw)
  To: openembedded-core

When building cargo-native on centos7 with buildtools tarball installed,
we see failures:

/bin/sh: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by /home/pokybuild/yocto-worker/reproducible-centos/build/build-st/tmp/work/x86_64-linux/cargo-native/1.54.0-r0/recipe-sysroot-native/usr/lib/libtinfo.so.5)

The reason for this is that the wrapper script
cargo-native/1.54.0-r0/wrapper/target-rust-ccld has /bin/sh as it's
interpreter and cargo calls this with LD_LIBRARY_PATH set to include the
recipe-sysroot-native. The host /bin/sh links to libtinfo from the host
but it finds the version in the sysroot which needs a newer libc. This
results in the above error since the loader is an older libc and the two
are incompatible.

Our ccld wrapper calls gcc/ld which don't need the LD_LIBRARY_PATH
variable set. We can't patch this out the source since we're using
a prebuilt binary to generate a new cargo binary so this is impossible
to bootstrap.

Instead, put a binary wrapper into place which removes LD_LIBRARY_PATH
from the environment before calling the original wrapper (left in shell
as it is simpler to maintain).

Also add the interpreter relocation trick from uninative to the prebuilt
cargo binary to match rust-native, just in case that causes other problems
later too.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/recipes-devtools/cargo/cargo.inc         | 12 ++++++++
 .../cargo/files/ccld-wrapper.c                | 29 +++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-devtools/cargo/files/ccld-wrapper.c

diff --git a/meta/recipes-devtools/cargo/cargo.inc b/meta/recipes-devtools/cargo/cargo.inc
index 6161c327e81..a114266eac4 100644
--- a/meta/recipes-devtools/cargo/cargo.inc
+++ b/meta/recipes-devtools/cargo/cargo.inc
@@ -20,6 +20,11 @@ inherit cargo
 
 do_cargo_setup_snapshot () {
 	${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
+	# 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
+		patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER}
+	fi
 }
 
 addtask cargo_setup_snapshot after do_unpack before do_configure
@@ -47,3 +52,10 @@ export LIBSSH2_SYS_USE_PKG_CONFIG = "1"
 # so we must use the locally set up snapshot to bootstrap the build.
 BASEDEPENDS:remove:class-native = "cargo-native"
 CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
+
+SRC_URI += "file://ccld-wrapper.c"
+
+do_rust_create_wrappers:append () {
+	mv ${RUST_TARGET_CCLD} ${RUST_TARGET_CCLD}.real
+	${BUILD_CC} ${WORKDIR}/ccld-wrapper.c -o ${RUST_TARGET_CCLD}
+}
diff --git a/meta/recipes-devtools/cargo/files/ccld-wrapper.c b/meta/recipes-devtools/cargo/files/ccld-wrapper.c
new file mode 100644
index 00000000000..6bc9958b907
--- /dev/null
+++ b/meta/recipes-devtools/cargo/files/ccld-wrapper.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2021 Richard Purdie
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * Run the original script (argv[0] + ".real") with LD_LIBRARY_PATH unset
+ * This avoids issues where cargo is running a wrapper script using /bin/sh from the host
+ * which links to something which has an incompatible version in in recipe-sysroot-native
+ * such as libtinfo on centos 7.
+ */
+
+int main(int argc, char* argv[]) {
+    char *real = malloc(strlen(argv[0] + 5));
+    strcpy(real, argv[0]);
+    strcpy(real + strlen(argv[0]), ".real");
+    putenv("LD_LIBRARY_PATH=");
+    if(execv(real, argv) == -1) {
+        printf("Wrapper failed to execute, error: %s\n", strerror(errno));
+        return -1;
+    }
+}
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-01 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 13:23 [PATCH 1/2] uninative: Upgrade to 3.4 Richard Purdie
2021-09-01 13:23 ` [PATCH 2/2] cargo: Hack around LD_LIBRARY_PATH issues on centos7 Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.