Skip to content
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

Cargo shouldn't set /WX (-Werror for MSVC linker) outside of CI #13620

Open
tbu- opened this issue Mar 22, 2024 · 2 comments
Open

Cargo shouldn't set /WX (-Werror for MSVC linker) outside of CI #13620

tbu- opened this issue Mar 22, 2024 · 2 comments
Labels
A-building-cargo-itself Area: issues with building cargo A-reproducibility Area: reproducible / deterministic builds C-bug Category: bug O-windows OS: Windows S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@tbu-
Copy link
Contributor

tbu- commented Mar 22, 2024

cargo/build.rs

Lines 99 to 100 in 8bcecfe

// Turn linker warnings into errors.
println!("cargo:rustc-link-arg-bin=cargo=/WX");

Setting /WX might make versions of Cargo harder to build in the future. If a new version of MSVC gets released that throws a warning here, users wanting to build an old version of Cargo will need to patch it to even make them build. See https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/ ("-Werror Introduces a Toolchain Version Dependency"). It's better to only enable /WX in CI, this way you can always change it, but don't leave users who want to compile Cargo with errors.

(from #13131 (comment)).

@weihanglo weihanglo added C-bug Category: bug A-building-cargo-itself Area: issues with building cargo A-reproducibility Area: reproducible / deterministic builds S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Mar 22, 2024
@ChrisDenton
Copy link
Contributor

Linker warnings (unlike compiler warnings) are very rare and almost always indicate an actual problem with the build (e.g. arguments being ignored). This is as relevant for local builds as for CI. Note that /WX:NO can be used to override it if you really do want to ignore warnings.

The better solution here would be for Rust to show linker warnings instead of hiding them.

@ChrisDenton
Copy link
Contributor

That first sentence should more accurately be "linker warnings that are not immediately followed by a fatal error are very rare".

@weihanglo weihanglo added the O-windows OS: Windows label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-building-cargo-itself Area: issues with building cargo A-reproducibility Area: reproducible / deterministic builds C-bug Category: bug O-windows OS: Windows S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

3 participants