Skip to content

Commit 2d7e215

Browse files
committed
Set AR with the archiver from cc-rs
cc-rs offers some variables to set the archiver program (commonly ar) that should be used for a given target. This is commonly used in cross-compilation situations, to use a version of AR compatible with the target linker.
1 parent fa4486d commit 2d7e215

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

jemalloc-sys/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ fn main() {
145145
println!("cargo:rustc-link-lib={}={}", kind, &stem[3..]);
146146
return;
147147
}
148-
149-
let compiler = cc::Build::new().get_compiler();
148+
let build = cc::Build::new();
149+
let compiler = build.get_compiler();
150+
let archiver = build.get_archiver();
150151
info!("CC={:?}", compiler.path());
152+
info!("AR={:?}", archiver.get_program());
151153

152154
assert!(out_dir.exists(), "OUT_DIR does not exist");
153155
let jemalloc_repo_dir = PathBuf::from("jemalloc");
@@ -182,6 +184,7 @@ fn main() {
182184
)
183185
.current_dir(&build_dir)
184186
.env("CC", compiler.path())
187+
.env("AR", archiver.get_program())
185188
.arg(format!("--with-version={je_version}"))
186189
.arg("--disable-cxx")
187190
.arg("--enable-doc=no")

0 commit comments

Comments
 (0)