summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2025-01-20 17:45:04 +0100
committerRoss Burton <ross.burton@arm.com>2025-01-23 12:14:29 +0000
commitdf026a95e3eec32e7a010c09b8e98351e74876b2 (patch)
tree587ea3fc712a4fea7d21bb4987364ec83ea2fa41
parent921b4649655a2d63675049495ba738ae823685b0 (diff)
downloadpoky-df026a95e3eec32e7a010c09b8e98351e74876b2.tar.gz
rust-common: add LDFLAGS to 'build-rust-cc' wrapper
Although rust differs between compiling (--> 'rust-cc' wrapper) and linking (--> 'rust-ccld' wrapper), some core crates are using only the 'rust-cc' wrapper to check for available compiler options [1] and libraries [2]. Not having LDFLAGS can break the build in subtle ways. E.g. 'cargo-native' can fail to build with | = note: .../hosttools/ld: .../liblibz_sys-....rlib(deflate.o): | relocation R_X86_64_32S against hidden symbol `_length_code' can not be used when making a PIE object because it does not find '-lz' (added by "DEPENDS = zlib") and builds a static libz.a with missing PIC flags. Add LDFLAGS to the 'build-rust-cc' wrapper as it is done already for the target one. [1] https://github.com/rust-lang/cc-rs/pull/1322 [2] https://github.com/rust-lang/libz-sys/blob/12a32798c6bd18986cb5cd603359b03c96f0eb4c/build.rs#L228-L234 (From OE-Core rev: 49b37575b548f0ab082c700f91fdd856740dc829) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Ross Burton <ross.burton@arm.com>
-rw-r--r--meta/classes-recipe/rust-common.bbclass2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes-recipe/rust-common.bbclass b/meta/classes-recipe/rust-common.bbclass
index 6940093e59..baa3869c47 100644
--- a/meta/classes-recipe/rust-common.bbclass
+++ b/meta/classes-recipe/rust-common.bbclass
@@ -173,7 +173,7 @@ do_rust_create_wrappers () {
173 mkdir -p "${WRAPPER_DIR}" 173 mkdir -p "${WRAPPER_DIR}"
174 174
175 # Yocto Build / Rust Host C compiler 175 # Yocto Build / Rust Host C compiler
176 create_wrapper_rust "${RUST_BUILD_CC}" "" "${CRATE_CC_FLAGS}" "${BUILD_CC}" 176 create_wrapper_rust "${RUST_BUILD_CC}" "" "${CRATE_CC_FLAGS}" "${BUILD_CC}" "${BUILD_LDFLAGS}"
177 # Yocto Build / Rust Host C++ compiler 177 # Yocto Build / Rust Host C++ compiler
178 create_wrapper_rust "${RUST_BUILD_CXX}" "" "${CRATE_CC_FLAGS}" "${BUILD_CXX}" 178 create_wrapper_rust "${RUST_BUILD_CXX}" "" "${CRATE_CC_FLAGS}" "${BUILD_CXX}"
179 # Yocto Build / Rust Host linker 179 # Yocto Build / Rust Host linker