When the target and build section triplet are identical  getting below error.
====================
error: failed to run custom build command for `memchr v2.3.3`

Also, in poky building for x86_64 using "RUST_TARGET_SYS" we were getting below 
error,
====================
Exception: configparser.DuplicateSectionError: Section 
'target.x86_64-unknown-linux-gnu' already exists

So, we are using x86_64-poky-linux as rust target as below,
====================
python3 src/bootstrap/bootstrap.py test --no-fail-fast --bless --target 
"x86_64-poky-linux"

By default, the rust does not support target option "x86_64-poky-linux",
by setting the path of "x86_64-poky-linux.json" to RUST_TARGET_PATH the rustc 
consider this for build.
The "x86_64-poky-linux.json" gets generated in 
"${STAGING_LIBDIR_NATIVE}/rustlib" so we changed
"RUST_TARGET_PATH" accordingly in rust-test.inc as below

Here, in case of x86_64 target we are using "TARGET_SYS" if both 
"RUST_TARGET_SYS" and
"SNAPSHOT_BUILD_SYS" are identical (x86_64-unknown-linux-gnu).

We were getting below warnings with x86_64 target and got fixed by "--bless" 
option.
====================
warning: Linking two modules of different data layouts: '' is 
'e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128' 
whereas 'lto_unwind.7rcbfp3g-cgu.3' is 'e-m:e-i64:64-f80:128-n8:16:32:64-S128'

Signed-off-by: Vinay Kumar <[email protected]>
---
 meta/recipes-devtools/rust/rust-test.inc | 37 ++++++++++++++++++------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-devtools/rust/rust-test.inc 
b/meta/recipes-devtools/rust/rust-test.inc
index 3a9b5b367c..1b12591421 100644
--- a/meta/recipes-devtools/rust/rust-test.inc
+++ b/meta/recipes-devtools/rust/rust-test.inc
@@ -10,8 +10,8 @@ DEPENDS += "file-native python3-native"
 DEPENDS_append_class-native = " rust-llvm-native"
 EXCLUDE_FROM_WORLD = "1"
 
-# We generate local targets, and need to be able to locate them
-export RUST_TARGET_PATH="${WORKDIR}/targets/"
+# In case of x86_64 target we setting this path to location of 
"x86_64-poky-linux.json".
+export RUST_TARGET_PATH="${STAGING_LIBDIR_NATIVE}/rustlib"
 
 export FORCE_CRATE_HASH="${BB_TASKHASH}"
 
@@ -410,8 +410,12 @@ python do_configure() {
 
     config = configparser.RawConfigParser()
 
-    # [target.ARCH-poky-linux]
-    target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True))
+    # [target.ARCH-unknown-linux-gnu] in case of x86_64 
[target.ARCH-poky-linux] 
+    if( d.getVar('RUST_TARGET_SYS', True) != d.getVar('SNAPSHOT_BUILD_SYS', 
True)):
+       target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True))
+    else :
+       target_section = "target.{}".format(d.getVar('TARGET_SYS', True))
+
     config.add_section(target_section)
 
     # Points to wrapper files which contain target specific compiler and 
linker commands. 
@@ -456,8 +460,12 @@ python do_configure() {
 
     config.set("build", "vendor", e(True))
 
-    # Here we are adding "RUST_TARGET_SYS" instead of "TARGET_SYS" as we are 
using rust supported target.
-    targets = [d.getVar("RUST_TARGET_SYS", True)]
+    # Here we are using "RUST_TARGET_SYS" and incase of x86_64 "TARGET_SYS" as 
rust supported target.
+    if( d.getVar('RUST_TARGET_SYS', True) != d.getVar('SNAPSHOT_BUILD_SYS', 
True)):
+        targets = [d.getVar("RUST_TARGET_SYS", True)]
+    else:
+        targets = [d.getVar("TARGET_SYS", True)]
+
     config.set("build", "target", e(targets))
 
     hosts = [d.getVar("SNAPSHOT_BUILD_SYS", True)]
@@ -495,7 +503,13 @@ rust_runx[vardepsexclude] += "PARALLEL_MAKE"
 # We have to build target specific remote-test-server 
 # Reference link - 
https://rustc-dev-guide.rust-lang.org/tests/intro.html#running-tests-on-a-remote-machine
 do_compile () {
-    rust_runx build src/tools/remote-test-server --target "${RUST_TARGET_SYS}"
+    if [  "${SNAPSHOT_BUILD_SYS}" = "${RUST_TARGET_SYS}" ]
+    then
+       rust_runx build src/tools/remote-test-server --target "${TARGET_SYS}"
+    else
+       rust_runx build src/tools/remote-test-server --target 
"${RUST_TARGET_SYS}"
+    fi
+
 }
 
 # To test the rust
@@ -506,7 +520,12 @@ do_check () {
     scp -P 2222 -o StrictHostKeyChecking=no 
build/${SNAPSHOT_BUILD_SYS}/stage2-tools-bin/remote-test-server 
[email protected]:~/
     ssh -p 2222 -o StrictHostKeyChecking=no -f [email protected] 
"~/remote-test-server -v remote"
 
-    export TEST_DEVICE_ADDR="127.0.0.1:12345" 
-    rust_runx test --no-fail-fast --target "${RUST_TARGET_SYS}" > summary.txt 
2> /dev/null
+    export TEST_DEVICE_ADDR="127.0.0.1:12345"
+    if [  "${SNAPSHOT_BUILD_SYS}" = "${RUST_TARGET_SYS}" ]
+    then
+       rust_runx test --no-fail-fast --bless --target "${TARGET_SYS}" > 
summary.txt 2> /dev/null
+    else
+       rust_runx test --no-fail-fast --target "${RUST_TARGET_SYS}" > 
summary.txt 2> /dev/null
+    fi
 }
 addtask do_check after do_compile
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#150469): 
https://lists.openembedded.org/g/openembedded-core/message/150469
Mute This Topic: https://lists.openembedded.org/mt/82112831/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to