summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorSean Nyekjaer <sean@geanix.com>2025-01-23 19:38:08 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-01 13:20:45 +0000
commit62e4c1e1df5358242dda50dec14027dc641d2d8a (patch)
tree75a77b519259aaa8680ef171d53000f7d2e37677 /meta
parent27d7a7540fccaf95bb5e309a7bdcde4ba80a6cc9 (diff)
downloadpoky-62e4c1e1df5358242dda50dec14027dc641d2d8a.tar.gz
rust-cross-canadian: set CC_<triple> for nativesdk
This fixes build errors when building rust bindings for C dependencies for the sdk host. This will allow us to build and run rust programs on the sdk host. Before: % cargo build --target x86_64-oesdk-linux-gnu -vv [...] Compiling zstd-sys v2.0.13+zstd.1.5.6 (zstd-rs/zstd-safe/zstd-sys) [zstd-sys 2.0.13+zstd.1.5.6] CC_x86_64-oesdk-linux-gnu = None [zstd-sys 2.0.13+zstd.1.5.6] CC = Some(arm-oe-linux-gnueabi-gcc -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=/usr/local/sdk/sysroots/cortexa7t2hf-neon-oe-linux-gnueabi) [zstd-sys 2.0.13+zstd.1.5.6] cargo:warning=ToolExecError: Command LC_ALL="C" "arm-oe-linux-gnueabi-gcc" "-mthumb" "-mfpu=neon" "-mfloat-abi=hard" "-mcpu=cortex-a7" "-D_TIME_BITS=64" "-D_FILE_OFFSET_BITS=64" "--sysroot=/usr/local/cc-sdk/sysroots/cortexa7t2hf-neon-oe-linux-gnueabi" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-O2" "-pipe" "-g" "-feliminate-unused-debug-types" "-flto" "-ffat-lto-objects" "-fuse-linker-plugin" "-fvisibility=hidden" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "zstd-rs/target/x86_64-oesdk-linux-gnu/debug/build/zstd-sys-b2560022e172eec3/out/44ff4c55aa9e5133-debug.o" "-c" "zstd/lib/common/debug.c" with args arm-oe-linux-gnueabi-gcc did not execute successfully (status code exit status: 1).cargo:warning=arm-oe-linux-gnueabi-gcc: error: unrecognized command-line option '-m64' After: % cargo build --target x86_64-oesdk-linux-gnu -vv [...] Compiling zstd-sys v2.0.13+zstd.1.5.6 (zstd-rs/zstd-safe/zstd-sys) [zstd-sys 2.0.13+zstd.1.5.6] CC_x86_64_oesdk_linux_gnu = Some(x86_64-oesdk-linux-gcc) [...] Compiling zstd v0.13.2 (zstd-rs) Finished dev [unoptimized + debuginfo] target(s) in 14.67s (From OE-Core rev: 3c8fedd6e5a3251b7a7a73cc92b153d8e68cb8e5) Signed-off-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/rust/rust_1.81.0.bb2
1 files changed, 2 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rust/rust_1.81.0.bb b/meta/recipes-devtools/rust/rust_1.81.0.bb
index 15ecbf74a0..fe8a81e7ae 100644
--- a/meta/recipes-devtools/rust/rust_1.81.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.81.0.bb
@@ -277,10 +277,12 @@ rust_do_install:class-nativesdk() {
277 mkdir "${ENV_SETUP_DIR}" 277 mkdir "${ENV_SETUP_DIR}"
278 RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh" 278 RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
279 RUST_HOST_TRIPLE=`echo ${RUST_HOST_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` 279 RUST_HOST_TRIPLE=`echo ${RUST_HOST_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'`
280 RUST_HOST_CC=`echo ${RUST_HOST_SYS} | sed 's/-/_/g'`
280 SDKLOADER=${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'i686', 'ld-linux.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'aarch64', 'ld-linux-aarch64.so.1', '', d)}${@bb.utils.contains('SDK_ARCH', 'ppc64le', 'ld64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'riscv64', 'ld-linux-riscv64-lp64d.so.1', '', d)} 281 SDKLOADER=${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'i686', 'ld-linux.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'aarch64', 'ld-linux-aarch64.so.1', '', d)}${@bb.utils.contains('SDK_ARCH', 'ppc64le', 'ld64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'riscv64', 'ld-linux-riscv64-lp64d.so.1', '', d)}
281 282
282 cat <<- EOF > "${RUST_ENV_SETUP_SH}" 283 cat <<- EOF > "${RUST_ENV_SETUP_SH}"
283 export CARGO_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/${SDKLOADER}" 284 export CARGO_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/${SDKLOADER}"
285 export CC_$RUST_HOST_CC="${CCACHE}${HOST_PREFIX}gcc"
284 EOF 286 EOF
285} 287}
286 288