diff mbox series

rust-cross-canadian: Fix for the issue caused by using sdk shell

Message ID 20220904073238.2707233-1-sundeep.kokkonda@gmail.com
State Accepted, archived
Commit 7cd6faf4e0147eef557f83fb266a25935e26efff
Headers show
Series rust-cross-canadian: Fix for the issue caused by using sdk shell | expand

Commit Message

Sundeep KOKKONDA Sept. 4, 2022, 7:32 a.m. UTC
[Yocto #14892]
This is a fix for YOCTO #14878 patch. When sheband is more than 128 characters the default shell /bin/sh is used instead of SDK shell, which causes problems with LD_LIBRARY_PATH.
With this patch shell usage is avoided.

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com>
---
 .../rust/files/target-rust-ccld.c             | 20 +++++++++++++++++++
 .../rust/rust-cross-canadian.inc              | 11 +++++-----
 2 files changed, 25 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-devtools/rust/files/target-rust-ccld.c

Comments

Sundeep KOKKONDA Sept. 4, 2022, 7:44 a.m. UTC | #1
Hello,

Since the issue " https://bugzilla.yoctoproject.org/show_bug.cgi?id=14892 " is sporadically appearing at autobuilder, I could not completely test it on my local machine. This patch is posted here to test it on YP AB machine.

I ensured the test is passed at my local machine.

> 
> SDK testing environment: cortexa57-poky-linux
> RESULTS:
> RESULTS - assimp.BuildAssimp.test_assimp: PASSED (78.38s)
> RESULTS - buildcpio.BuildCpioTest.test_cpio: PASSED (42.25s)
> RESULTS - buildepoxy.EpoxyTest.test_epoxy: PASSED (18.43s)
> RESULTS - buildgalculator.GalculatorTest.test_galculator: PASSED (16.29s)
> RESULTS - buildlzip.BuildLzipTest.test_lzip: PASSED (2.41s)
> RESULTS - gcc.GccCompileTest.test_gcc_compile: PASSED (0.11s)
> RESULTS - gcc.GccCompileTest.test_gpp2_compile: PASSED (0.13s)
> RESULTS - gcc.GccCompileTest.test_gpp_compile: PASSED (0.35s)
> RESULTS - gcc.GccCompileTest.test_make: PASSED (0.11s)
> RESULTS - perl.PerlTest.test_perl: PASSED (0.03s)
> RESULTS - python.Python3Test.test_python3: PASSED (0.04s)
> RESULTS - rust.RustCompileTest.test_cargo_build: PASSED (0.26s)
> SUMMARY:
> core-image-sato sdk
> (poky-glibc-x86_64-core-image-sato-cortexa57-qemuarm64-toolchain-4.1+snapshot.sh:environment-setup-cortexa57-poky-linux)
> - Ran 12 tests in 158.803s
> core-image-sato sdk - OK - All required tests passed (successes=12,
> skipped=0, failures=0, errors=0)
> NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun
> and all succeeded.
> 
> 
> 
> 

Please test the patch on autobuilder and let me know if it is ok.

--
Thanks
Sundeep K.

> 
> 
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rust/files/target-rust-ccld.c b/meta/recipes-devtools/rust/files/target-rust-ccld.c
new file mode 100644
index 0000000000..5d903a0d1e
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/target-rust-ccld.c
@@ -0,0 +1,20 @@ 
+/*
+*
+* Copyright (C) 2022      Wind River Systems
+*
+* SPDX-License-Identifier: GPL-2.0-only
+*
+*/
+
+        #include <string.h>
+        #include <stdlib.h>
+        #include <unistd.h>
+
+        int main (int argc, char *argv[])
+        {
+        unsetenv("LD_LIBRARY_PATH");
+        execvp("x86_64-pokysdk-linux-gcc",argv);
+
+        return 0;
+	}
+
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index 7bf75a4712..375c435bff 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -7,16 +7,15 @@  LICENSE = "MIT"
 
 MODIFYTOS = "0"
 
+DEPENDS += "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+SRC_URI += "file://target-rust-ccld.c"
+
 # Need to use our SDK's sh here, see #14878
 create_sdk_wrapper () {
         file="$1"
         shift
-
-        cat <<- EOF > "${file}"
-		#!${base_prefix}/bin/sh
-		\$$1 \$@
-		EOF
-
+	${CC} ${WORKDIR}/target-rust-ccld.c -o "${file}"
         chmod +x "$file"
 }