Closed molysgaard closed 1 month ago
This is not an issue of the libc
crate, but of the rust compiler, since rustc
invokes the linker. You should be able to use CARGO_TARGET_<triple>_LINKER
to set the linker or alternartively open an issue at rust compiler repository.
The cc
crate should actually respect these, but @jschwe is correct that rustc does not use CC
as the linker. The linker can be specified in a Cargo config file https://doc.rust-lang.org/cargo/reference/config.html?highlight=linker#targettriplelinker, or by passing -Clinker=...
to rustc
.
I don't think there is anything to do here so I will close this, feel free to follow up if there is more.
To reproduce:
cc
binary, but does have eg.gcc
installedCC=gcc cargo build
error: could not compile
libc
(build script) due to 1 previous errorBroken example using guix
Working example using guix
In this example, we add a symlink named
cc
in our PATH that points togcc
.