-
Notifications
You must be signed in to change notification settings - Fork 544
Description
When I use cc natively on Linux or macOS, cc::Build::get_archiver always returns ar when I'm building for either x86 musl or ARM musl. However, when I try to do the same build in a rust Docker image, and the --platform is not my native platform, it sometimes attempts other names for the archiver program (like musl-ar or aarch64-linux-musl-ar) which cause the build to fail.
This forces me to set a TARGET_AR variable in my Dockerfile if I depend on crates like wasmtime that transitively depend on crates like zstd-sys; see this Stack Overflow question for such an example, which is itself boiled down from gradbench/gradbench#233 that was my real use case.
See this GitHub repository which includes a full code example to reproduce the issue. As also written in that README.md, here are the different values I see returned by cc::Build::get_archiver in various contexts:
- ARM macOS
- native:
"ar" - native targeting x86 musl:
"ar" - native targeting ARM musl:
"ar" - Docker targeting x86 musl:
"musl-ar" - Docker targeting ARM musl:
"ar"
- native:
- x86 Linux
- native:
"ar" - native targeting x86 musl:
"ar" - native targeting ARM musl:
"ar" - Docker targeting x86 musl:
"ar" - Docker targeting ARM musl:
"aarch64-linux-musl-ar"
- native: