Skip to content

Cygwin support in rustc #140154

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

Merged
merged 4 commits into from
May 19, 2025
Merged

Cygwin support in rustc #140154

merged 4 commits into from
May 19, 2025

Conversation

Berrysoft
Copy link
Contributor

@Berrysoft Berrysoft commented Apr 22, 2025

This PR builds host rustc targeting cygwin.

Currently supported:

  • rustc
  • rustdoc
  • rustfmt
  • clippy

Blocking:

$ rustc --version --verbose
rustc 1.88.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-cygwin
release: 1.88.0-dev
LLVM version: 20.1.4

@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2025

r? @compiler-errors

rustbot has assigned @compiler-errors.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 22, 2025
@Berrysoft

This comment was marked as outdated.

@jieyouxu jieyouxu added the O-cygwin Target: *-pc-cygwin label Apr 25, 2025
@jeremyd2019
Copy link
Contributor

I'm looking forward to being able to try this, and I bet @tyan0 and others from Cygwin are too!

@jeremyd2019
Copy link
Contributor

jeremyd2019 commented May 8, 2025

The build script of rustc_llvm is modified a little because llvm-config of MSYS2 is broken:

This should be fixed now (llvm/llvm-project#136599), and _GNU_SOURCE is defined in llvm-config --cppflags and friends (llvm/llvm-project#138329):

$ llvm-config --cxxflags
-I/usr/include -std=c++17   -fno-exceptions -funwind-tables -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

@Berrysoft

This comment was marked as outdated.

@Berrysoft Berrysoft force-pushed the cygwin-host branch 2 times, most recently from 7ee303f to d23fa03 Compare May 13, 2025 16:35
@Berrysoft Berrysoft changed the title Experimental cygwin support in rustc Cygwin support in rustc May 14, 2025
@Berrysoft
Copy link
Contributor Author

r? @jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned compiler-errors May 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 16, 2025

The Miri subtree was changed

cc @rust-lang/miri

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Seems fine, I'll r+ after PR CI is green.

@jieyouxu
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 16, 2025

📌 Commit 12c8fb8 has been approved by jieyouxu

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels May 16, 2025
let fname_ptr = info.dli_fname.as_ptr();
#[cfg(not(target_os = "cygwin"))]
let fname_ptr = {
if info.dli_fname.is_null() {
Copy link
Member

Choose a reason for hiding this comment

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

Hm, this can be null? I can't find that in the docs. Miri seems to assume it's never null...

(This is pre-existing, not new in this PR.)

Copy link
Contributor

@jeremyd2019 jeremyd2019 May 16, 2025

Choose a reason for hiding this comment

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

https://man7.org/linux/man-pages/man3/dladdr.3.html

If the address specified in addr could not be matched to a shared
object, then these functions return 0. In this case, an error
message is not available via dlerror(3).

My read of that is that either it finds a shared object, in which case dli_fname is valid, or else it will return 0 (but not tell you why in dlerror).

Copy link
Member

Choose a reason for hiding this comment

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

dladdr can return null, yes. That's handled above. I am talking about dli_fname being null, which is different and which should not be possible according to the docs.

fmease added a commit to fmease/rust that referenced this pull request May 18, 2025
Cygwin support in rustc

This PR builds host rustc targeting cygwin.

- [x] rust-lang/stacker#122
- [x] nagisa/rust_libloading#173
- [x] Detegr/rust-ctrlc#131
- [x] rust-random/getrandom#654
- [x] msys2/MSYS2-packages#5350
- [x] rust-lang#140886
- [x] rust-lang#140921
- [x] rust-lang#140973

Currently supported:
* rustc
* rustdoc
* rustfmt
* clippy

Blocking:
* cargo: blocked by rust-lang/socket2#568
* rust-analyzer: needs `cargo update`, fixed upstream

```
$ rustc --version --verbose
rustc 1.88.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-cygwin
release: 1.88.0-dev
LLVM version: 20.1.4
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 18, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#127013 (Add `f16` formatting and parsing)
 - rust-lang#140154 (Cygwin support in rustc)
 - rust-lang#140628 (std: stop using TLS in signal handler)
 - rust-lang#140966 (Remove #![feature(let_chains)] from library and src/librustdoc)
 - rust-lang#140994 (replace `cc_detect::cc2ar` with `cc::try_get_archiver`)
 - rust-lang#141127 (bump windows crate for compiler,bootstrap and tools)

r? `@ghost`
`@rustbot` modify labels: rollup
fmease added a commit to fmease/rust that referenced this pull request May 18, 2025
Cygwin support in rustc

This PR builds host rustc targeting cygwin.

- [x] rust-lang/stacker#122
- [x] nagisa/rust_libloading#173
- [x] Detegr/rust-ctrlc#131
- [x] rust-random/getrandom#654
- [x] msys2/MSYS2-packages#5350
- [x] rust-lang#140886
- [x] rust-lang#140921
- [x] rust-lang#140973

Currently supported:
* rustc
* rustdoc
* rustfmt
* clippy

Blocking:
* cargo: blocked by rust-lang/socket2#568
* rust-analyzer: needs `cargo update`, fixed upstream

```
$ rustc --version --verbose
rustc 1.88.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-cygwin
release: 1.88.0-dev
LLVM version: 20.1.4
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 18, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang#127013 (Add `f16` formatting and parsing)
 - rust-lang#138940 (Stabilize the avx512 target features)
 - rust-lang#140154 (Cygwin support in rustc)
 - rust-lang#140490 (split `asm!` parsing and validation)
 - rust-lang#140628 (std: stop using TLS in signal handler)
 - rust-lang#140746 (name resolution for guard patterns)
 - rust-lang#140926 (Return value of coroutine_layout fn changed to Result with LayoutError)
 - rust-lang#141127 (bump windows crate for compiler,bootstrap and tools)
 - rust-lang#141214 (Miri subtree update)
 - rust-lang#141218 (gvn: avoid creating overlapping assignments)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented May 18, 2025

⌛ Testing commit 12c8fb8 with merge 27c4e28...

bors added a commit to rust-lang-ci/rust that referenced this pull request May 18, 2025
Cygwin support in rustc

This PR builds host rustc targeting cygwin.

- [x] rust-lang/stacker#122
- [x] nagisa/rust_libloading#173
- [x] Detegr/rust-ctrlc#131
- [x] rust-random/getrandom#654
- [x] msys2/MSYS2-packages#5350
- [x] rust-lang#140886
- [x] rust-lang#140921
- [x] rust-lang#140973

Currently supported:
* rustc
* rustdoc
* rustfmt
* clippy

Blocking:
* cargo: blocked by rust-lang/socket2#568
* rust-analyzer: needs `cargo update`, fixed upstream

```
$ rustc --version --verbose
rustc 1.88.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-cygwin
release: 1.88.0-dev
LLVM version: 20.1.4
```
@fmease
Copy link
Member

fmease commented May 18, 2025

@bors retry (yield to rollup, sry)

fmease added a commit to fmease/rust that referenced this pull request May 18, 2025
Cygwin support in rustc

This PR builds host rustc targeting cygwin.

- [x] rust-lang/stacker#122
- [x] nagisa/rust_libloading#173
- [x] Detegr/rust-ctrlc#131
- [x] rust-random/getrandom#654
- [x] msys2/MSYS2-packages#5350
- [x] rust-lang#140886
- [x] rust-lang#140921
- [x] rust-lang#140973

Currently supported:
* rustc
* rustdoc
* rustfmt
* clippy

Blocking:
* cargo: blocked by rust-lang/socket2#568
* rust-analyzer: needs `cargo update`, fixed upstream

```
$ rustc --version --verbose
rustc 1.88.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-cygwin
release: 1.88.0-dev
LLVM version: 20.1.4
```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 18, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#127013 (Add `f16` formatting and parsing)
 - rust-lang#130887 (Safer implementation of RepeatN)
 - rust-lang#140154 (Cygwin support in rustc)
 - rust-lang#140874 (make `rustc_attr_parsing` less dominant in the rustc crate graph)
 - rust-lang#141094 (add regression test for rust-lang#101650)
 - rust-lang#141110 ([std] fix the presentation of `split_off_mut` and `split_off` documentation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented May 18, 2025

⌛ Testing commit 12c8fb8 with merge e42bbfe...

@bors
Copy link
Collaborator

bors commented May 19, 2025

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing e42bbfe to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 19, 2025
@bors bors merged commit e42bbfe into rust-lang:master May 19, 2025
7 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 19, 2025
@Berrysoft Berrysoft deleted the cygwin-host branch May 19, 2025 03:06
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 4d051fb (parent) -> e42bbfe (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard e42bbfe1f7c26f8760a99c4b1f27d33aba1040bb --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-msvc: 8392.8s -> 9988.1s (19.0%)
  2. dist-x86_64-msvc-alt: 7229.5s -> 8453.0s (16.9%)
  3. x86_64-apple-2: 4440.8s -> 5014.1s (12.9%)
  4. x86_64-apple-1: 6936.2s -> 7747.4s (11.7%)
  5. dist-arm-linux: 4717.1s -> 5118.8s (8.5%)
  6. dist-apple-various: 6435.1s -> 6031.4s (-6.3%)
  7. dist-aarch64-apple: 5038.3s -> 5350.2s (6.2%)
  8. dist-x86_64-mingw: 7570.2s -> 7985.9s (5.5%)
  9. i686-msvc-1: 9029.3s -> 9483.5s (5.0%)
  10. x86_64-gnu-stable: 6518.7s -> 6823.8s (4.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. O-cygwin Target: *-pc-cygwin 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants