Skip to content

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Feb 28, 2025

What does this PR try to resolve?

GitHub Runner Images 20250224.5.0+ ship Windows 11 SDK 10.0.26100+ compared to the previous Windows 11 SDK 10.0.22621, which bumped the UCRT headers. The new UCRT headers use SSE2 types. However, cc versions <= 1.2.15 emit /arch:IA32 for x86 Windows targets for clang-cl, which causes compilation errors since clang-cl can't find SSE2 types without /arch:SSE2 specified (or defaulted). (Note that MSVC at the time of writing silently accepts and emits instruments for code using SSE2 types, as opposed to clang-cl hard error-ing).

cc 1.2.16 contains a fix for this problem, rust-lang/cc-rs#1425, to correctly emit /arch:SSE2 instead of /arch:IA32 to enable clang-cl to find the SSE2 types. However, cargo's cc currently is still on 1.2.13.

To fix this for rust-lang/rust CI, we need to bump anything that transitively relies on cc and tries to use clang-cl on x86 Windows targets to compile any C/C++ code that transitively use functions or types that require SSE2 types, such as <wchar.h>.

How should we test and review this PR?

The fix was initially intended for rustc_{codegen_ssa,llvm} cc, and based on testing in rust-lang/rust#137724, I was able to successfully build rustc_{codegen_ssa,llvm} with a forked cc based on 1.2.15 which contains the fix from rust-lang/cc-rs#1425. Note that in the same PR, while the compiler build succeeded, the build of cargo itself failed since it transitively used a cc without the fix to build curl-sys1, which failed as one might expect (curl-sys tries to build C code that uses <wchar.h> which runs into the same problem). Hence, this PR is opened to bump cargo's cc to a cc version containing the fix.

Additional information

This x86 Windows CI problem is:

cc changelog between 1.2.13 and 1.2.16

`cc` changes since 1.2.13 up to and including 1.2.16
1.2.16 - 2025-02-28
Fixed
Other
1.2.15 - 2025-02-21
Other
  • Regenerate target info (#1406)
  • Always read from all CFLAGS-style flags (#1401)
  • Simplify the error output on failed Command invocation (#1397)
1.2.14 - 2025-02-14
Other
  • Regenerate target info (#1398)
  • Add support for setting -gdwarf-{version} based on RUSTFLAGS (#1395)
  • Add support for alternative network stack io-sock on QNX 7.1 aarch64 and x86_64 (#1312)

Footnotes

  1. I think the dep chain is something like git2 -> libgit2-sys -> curl -> curl-sys?

GitHub Runner Images 20250224.5.0+ ship Windows 11 SDK 10.0.26100+ from
the previous Windows 11 SDK 10.0.22621, which bumped the UCRT headers.
The new UCRT headers use SSE2 types. However, `cc` versions <= 1.2.15
emit `/arch:IA32` for `x86` Windows targets for `clang-cl`, which causes
compilation errors since `clang-cl` can't find SSE2 types without
`/arch:SSE2` specified (or defaulted). (Note that MSVC at the time of
writing silently accepts and emits instruments for code using SSE2
types, as opposed to `clang-cl` hard error-ing).

To fix this for rust-lang/rust CI, we need to bump anything that
transitively relies on `cc` and tries to use `clang-cl` on `x86` Windows
targets to compile any C/C++ code that transitively use functions or
types that require SSE2 types, such as `<wchar.h>`. `cc` 1.2.16 contains
<rust-lang/cc-rs#1425> which emits `/arch:SSE2`
instead of `/arch:IA32` for `x86` Windows targets when using `clang-cl`.
@rustbot
Copy link
Collaborator

rustbot commented Feb 28, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 28, 2025
@epage epage added this pull request to the merge queue Feb 28, 2025
Merged via the queue into rust-lang:master with commit 2622e84 Feb 28, 2025
23 checks passed
@jieyouxu jieyouxu deleted the hotfix-cc-x86 branch February 28, 2025 13:02
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 28, 2025
Update cargo

11 commits in 1d1d646c06a84c1aa53967b394b7f1218f85db82..2622e844bc1e2e6123e54e94e4706f7b6195ce3d
2025-02-21 21:38:53 +0000 to 2025-02-28 12:33:57 +0000
- Bump `cc` to 1.2.16 to fix `x86` windows jobs in rust-lang/rust CI (rust-lang/cargo#15245)
- refactor(tree): Abstract the concept of a NodeId (rust-lang/cargo#15237)
- feat: implement RFC 3553 to add SBOM support (rust-lang/cargo#13709)
- refactor(tree): Abstract the concept of an edge (rust-lang/cargo#15233)
- chore: bump openssl to v3 (rust-lang/cargo#15232)
- fix(package): Register workspace member renames in overlay  (rust-lang/cargo#15228)
- Implemented `build.build-dir` config option (rust-lang/cargo#15104)
- feat: add completions for `--manifest-path` (rust-lang/cargo#15225)
- chore: semver-check build-rs against beta channel (rust-lang/cargo#15223)
- chore: depend on openssl-sys to correctly pin its version (rust-lang/cargo#15224)
- chore: dont check cargo-util semver until 1.86 is released (rust-lang/cargo#15222)
@rustbot rustbot added this to the 1.87.0 milestone Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants