Open oblique opened 5 years ago
@alexcrichton Since you have more experience for -sys
and -src
crates. Do you have any Ideas on how to fix this? /GL-
is already used. Do you think that I should post this in Rust repo?
I don't have much experience with windows either I'm afraid, so I won't be able to help much.
I'm not so certain myself unfortunately, but this looks like it's sort of a routine linking error where either the C standard library isn't specified or it's the wrong C standard library by accident (/MD
vs /MT
)
If I add -Copt-level=z
in RUSTFLAGS
, for some reason it works. In this case -Copt-level=3 -Copt-level=z
is passed to rustc
(the -Copt-level=3
part is added by cargo). This is more confusing.
I think I'm going to open an issue in Rust. It looks like a bug.
I tried to compile a project on Windows and I was getting linkage error. After some investigation I found the it has to do with
opt-leve=z
(set inCargo.toml
) and-Ctarget-feature=+crt-static
(set inRUSTFLAGS
env var). If I omit one of the two, the everything works, however this is not an option for the actual project.I created a repo with minimal example that reproduces the problem: oblique/optlevel-z-crt-static-issue. You can view the linkage error here.
I have no idea why this is caused since I don't have a lot experience with Windows. Also I'm not sure if this is a bug in
rustc
.The error: