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

Ensure that static_crt is set in the bootstrapper whenever using cc-rs to get a compiler command line. #98434

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

dpaoliello
Copy link
Contributor

When attempting to build rustc with LLVM on Windows, I noticed that the CRT flag provided to the C and C++ Compilers was inconsistent:

"-DCMAKE_C_FLAGS=-nologo -MT -Brepro" "-DCMAKE_CXX_FLAGS=-nologo -MD -Brepro"

Since the bootstrapper also sets the various LLVM_USE_CRT variables, this resulted in cl.exe reporting a bunch of warnings:

cl : Command line warning D9025 : overriding '/MD' with '/MT'

The root cause for this is that cc_detect::find was creating a cc::Build twice, but didn't set static_crt the second time.

It's possible that this what is also causing #81381

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2022
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with the new bug fixed

src/bootstrap/cc_detect.rs Show resolved Hide resolved
@jyn514 jyn514 assigned jyn514 and unassigned Mark-Simulacrum Jun 26, 2022
@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 26, 2022
…c` to get a compiler command line.

When attempting to build rustc with LLVM on Windows, I noticed that the CRT flag provided to the C and C++ Compilers was inconsistent:

```
"-DCMAKE_C_FLAGS=-nologo -MT -Brepro" "-DCMAKE_CXX_FLAGS=-nologo -MD -Brepro"
```

Since the bootstrapper also sets the various `LLVM_USE_CRT` variables, this resulted in cl.exe reporting a bunch of warnings:

```
cl : Command line warning D9025 : overriding '/MD' with '/MT'
```

The root cause for this is that `cc_detect::find` was creating a `cc::Build` twice, but didn't set `static_crt` the second time.

It's possible that this what is also causing rust-lang#81381
@jyn514
Copy link
Member

jyn514 commented Jun 27, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jun 27, 2022

📌 Commit 1fca246 has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 27, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 29, 2022
Ensure that `static_crt` is set in the bootstrapper whenever using `cc-rs` to get a compiler command line.

When attempting to build rustc with LLVM on Windows, I noticed that the CRT flag provided to the C and C++ Compilers was inconsistent:

```
"-DCMAKE_C_FLAGS=-nologo -MT -Brepro" "-DCMAKE_CXX_FLAGS=-nologo -MD -Brepro"
```

Since the bootstrapper also sets the various `LLVM_USE_CRT` variables, this resulted in cl.exe reporting a bunch of warnings:

```
cl : Command line warning D9025 : overriding '/MD' with '/MT'
```

The root cause for this is that `cc_detect::find` was creating a `cc::Build` twice, but didn't set `static_crt` the second time.

It's possible that this what is also causing rust-lang#81381
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 29, 2022
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#98434 (Ensure that `static_crt` is set in the bootstrapper whenever using `cc-rs` to get a compiler command line.)
 - rust-lang#98636 (Triagebot: Fix mentions word wrapping.)
 - rust-lang#98642 (Fix rust-lang#98260)
 - rust-lang#98643 (Improve pretty printing of valtrees for references)
 - rust-lang#98646 (rustdoc: fix bugs in main.js popover help and settings)
 - rust-lang#98647 (Update cargo)
 - rust-lang#98652 (`alloc`: clean and ensure `no_global_oom_handling`  builds are warning-free)
 - rust-lang#98660 (Unbreak stage1 tests via ignore-stage1 in `proc-macro/invalid-punct-ident-1.rs`.)
 - rust-lang#98665 (Use verbose help for deprecation suggestion)
 - rust-lang#98668 (Avoid some `&str` to `String` conversions with `MultiSpan::push_span_label`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 96bb98c into rust-lang:master Jun 29, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jun 29, 2022
@dpaoliello dpaoliello deleted the staticcrt branch January 16, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants