Skip to content

Commit 49b3757

Browse files
enscrossburton
authored andcommitted
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] rust-lang/cc-rs#1322 [2] https://github.com/rust-lang/libz-sys/blob/12a32798c6bd18986cb5cd603359b03c96f0eb4c/build.rs#L228-L234 Signed-off-by: Enrico Scholz <[email protected]> Signed-off-by: Mathieu Dubois-Briand <[email protected]> Signed-off-by: Ross Burton <[email protected]>
1 parent 729611f commit 49b3757

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

meta/classes-recipe/rust-common.bbclass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ do_rust_create_wrappers () {
173173
mkdir -p "${WRAPPER_DIR}"
174174

175175
# 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}"
177177
# Yocto Build / Rust Host C++ compiler
178178
create_wrapper_rust "${RUST_BUILD_CXX}" "" "${CRATE_CC_FLAGS}" "${BUILD_CXX}"
179179
# Yocto Build / Rust Host linker

0 commit comments

Comments
 (0)