-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build error when using crt-static in dot cargo config #46
Comments
Hm to confirm you're using the most up to date versions of all dependencies, right? This should in theory be automatically detected and configured. Can you provide the full output logs you're seeing perhaps? |
So using nightly (updated today using
Cargo.toml is
( Cargo.lock is new (using
The full log is
And passing RUSTFLAGS works:
Let me know if you need anything else! |
Can you try compiling with |
|
And the working version:
|
Ok thanks for the logs! Unfortunately cc-rs didn't print out as much debugging information as I would have thought... I unfortuantely don't have access to a Windows machine to fully reproduce this, but I can't seem to reproduce this with some local testing. To try to double check things, in your build script, can you print out the result of |
Failing build (
With working version (
|
Seems like a bug in cargo then? I added the following tests: And the second one fail as expected. RUSTFLAGS test:
Config test:
Let me know if I can help! I can try to implement a fix if you point me in the right direction :) |
So the problem seems to be in env_args (cargo/core/compiler/build_context/mod.rs).. There seems to be an empty It's also is a bit non-intuitive as I would expect it to combine both values. I made this change and it seems to fix it. If it looks OK to you I'll go and open a PR there.
|
Ah ok, definitely makes sense that an empty env var would trick cargo! That change seems reasonable to me to land in Cargo |
Hi,
I ran into a problem when trying to use the
xz2
crate withcrt-static
under windows.The minimal test case is a crate which depends on
xz2 = "*"
, and has a.cargo/config
file with:It will fail to compile with
(aka
/MD
is passed to the compiler and not/MT
as expected)It's a subtly different case than using
RUSTFLAGS
(which is already tested),I think because
cc::Build
looks atCARGO_CFG_TARGET_FEATURE
(which in my tests seems to be set to
fxsr,mmx,sse,sse2
).I forked and played with a solution which works for me (using
#[cfg(target_feature = "crt-static")]
),but I wasn't sure if the issue is here, in
cc
, incargo
, etc..https://github.com/alexcrichton/xz2-rs/compare/master...ohadravid:bugfix/static-crt-build-fail-when-using-dot-cargo-config?expand=1
The text was updated successfully, but these errors were encountered: