From a6bbe3f79452892ef0eabc8c2b72d3d3c015e32c Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Sun, 12 Jun 2022 13:03:25 -0400 Subject: [PATCH] buildRustCrate: pass link flags when building libraries With Rust 1.61, it is necessary to link to external static/dynamic libaries when building the rlib that uses them, rather than when linking the final binary. In fact, it is no longer necessary to specify the libraries to link when building the final binary, but the library search path flags must still be included. --- pkgs/build-support/rust/build-rust-crate/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/rust/build-rust-crate/lib.sh b/pkgs/build-support/rust/build-rust-crate/lib.sh index d4927b025aa8..39f7d53f6f75 100644 --- a/pkgs/build-support/rust/build-rust-crate/lib.sh +++ b/pkgs/build-support/rust/build-rust-crate/lib.sh @@ -16,6 +16,7 @@ build_lib() { --out-dir target/lib \ -L dependency=target/deps \ --cap-lints allow \ + $LINK \ $LIB_RUSTC_OPTS \ $BUILD_OUT_DIR \ $EXTRA_BUILD \ @@ -97,7 +98,6 @@ setup_link_paths() { if [[ ! -z "$i" ]]; then for library in $i; do echo "-l $library" >> target/link - echo "-l $library" >> target/link.final done fi done