Skip to content

Commit d2ffa5b

Browse files
roblablareneleonhardt
authored andcommitted
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. Signed-off-by: roblabla <[email protected]> Signed-off-by: Rene Leonhardt <[email protected]>
1 parent 5c5a9f7 commit d2ffa5b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jemalloc-sys/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ fn main() {
147147
}
148148
// Disable -Wextra warnings - jemalloc doesn't compile free of warnings with
149149
// it enabled: https://github.com/jemalloc/jemalloc/issues/1196
150-
let compiler = cc::Build::new().extra_warnings(false).get_compiler();
150+
let mut build = cc::Build::new();
151+
let build = build.extra_warnings(false);
152+
let (compiler, archiver) = (build.get_compiler(), build.get_archiver());
151153
let cflags = compiler
152154
.args()
153155
.iter()
@@ -156,6 +158,7 @@ fn main() {
156158
.join(" ");
157159
info!("CC={:?}", compiler.path());
158160
info!("CFLAGS={:?}", cflags);
161+
info!("AR={:?}", archiver.get_program());
159162

160163
assert!(out_dir.exists(), "OUT_DIR does not exist");
161164
let jemalloc_repo_dir = PathBuf::from("jemalloc");
@@ -193,6 +196,7 @@ fn main() {
193196
.env("CFLAGS", cflags.clone())
194197
.env("LDFLAGS", cflags.clone())
195198
.env("CPPFLAGS", cflags)
199+
.env("AR", archiver.get_program())
196200
.arg(format!("--with-version={je_version}"))
197201
.arg("--disable-cxx")
198202
.arg("--enable-doc=no")

0 commit comments

Comments
 (0)