Open Systemcluster opened 1 year ago
A smaller crate to reproduce this with is sys-info, which only depends on cc
and libc
. Reproduction setup: https://github.com/Systemcluster/rust-profile-rustflags-issue
This issue occurs with the nightly-x86_64-pc-windows-msvc
toolchain, I have not tried non-msvc
toolchains or non-default linkers.
Problem
Specifying
rustflags = ["-Ctarget-feature=+crt-static"]
inCargo.toml
does not properly propagate the setting and results in inconsistencies.For example, when using
mimalloc
with this setting, linking results in a conflict betweenMSVCRT
andlibucrt
:Steps
Create an example project with this
Cargo.toml
:Use
mimalloc
in themain.rs
:Compile with
cargo build --release
. It will result in the above error during the linking step.Possible Solution(s)
No response
Notes
Adding
rustflags = ["-Ctarget-feature=+crt-static"]
to the[build]
section in.cargo/config.toml
works fine, with or without the profile rustflags.Version