Rust code compilation on qemu failed with with below error. error: Error loading target specification: Could not find specification for target "x86_64-poky-linux-gnu". Run `rustc --print target-list` for a list of built-in targets.
This patch fix the issue by adding the missing json file to the image. Signed-off-by: Sundeep KOKKONDA <[email protected]> --- meta/recipes-devtools/rust/files/target.json | 39 ++++++++++++++++++++ meta/recipes-devtools/rust/rust.inc | 9 +++++ meta/recipes-devtools/rust/rust_1.65.0.bb | 2 + 3 files changed, 50 insertions(+) create mode 100644 meta/recipes-devtools/rust/files/target.json diff --git a/meta/recipes-devtools/rust/files/target.json b/meta/recipes-devtools/rust/files/target.json new file mode 100644 index 0000000000..69dbbaa9f9 --- /dev/null +++ b/meta/recipes-devtools/rust/files/target.json @@ -0,0 +1,39 @@ +{ + "arch": "x86_64", + "cpu": "x86-64", + "crt-static-respected": true, + "data-layout": +"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "dynamic-linking": true, + "env": "gnu", + "executables": true, + "has-rpath": true, + "linker-is-gnu": true, + "llvm-target": "x86_64-unknown-linux-gnu", + "max-atomic-width": 64, + "os": "linux", + "position-independent-executables": true, + "pre-link-args": { + "gcc": [ + "-m64" + ] + }, + "relro-level": "full", + "stack-probes": { + "kind": "inline-or-call", + "min-llvm-version-for-inline": [ + 11, + 0, + 1 + ] + }, + "supported-sanitizers": [ + "address", + "leak", + "memory", + "thread" + ], + "target-family": "unix", + "target-pointer-width": "64" +} + diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc index 956301023a..75473f967b 100644 --- a/meta/recipes-devtools/rust/rust.inc +++ b/meta/recipes-devtools/rust/rust.inc @@ -13,6 +13,10 @@ DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" S = "${RUSTSRC}" +SRC_URI += "\ + file://target.json \ +" + export FORCE_CRATE_HASH="${BB_TASKHASH}" RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" @@ -217,3 +221,8 @@ rust_do_install () { do_install () { rust_do_install } + +FILE_${PN} += " \ + ${WORKDIR}/target.json \ +" + diff --git a/meta/recipes-devtools/rust/rust_1.65.0.bb b/meta/recipes-devtools/rust/rust_1.65.0.bb index dbf74cec8f..afef72e45c 100644 --- a/meta/recipes-devtools/rust/rust_1.65.0.bb +++ b/meta/recipes-devtools/rust/rust_1.65.0.bb @@ -68,6 +68,8 @@ rust_do_install:class-target() { chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i done + cp ${WORKDIR}/target.json ${D}${libdir}/rustlib/${RUST_TARGET_SYS} + chown root:root ${D}/ -R rm ${D}${libdir}/rustlib/uninstall.sh rm ${D}${libdir}/rustlib/install.log -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#174396): https://lists.openembedded.org/g/openembedded-core/message/174396 Mute This Topic: https://lists.openembedded.org/mt/95535785/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
