Skip to content

Add cygwin support #568

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

Berrysoft
Copy link
Contributor

This PR makes it compile on cygwin.

Copy link
Collaborator

@Thomasdezeeuw Thomasdezeeuw left a comment

Choose a reason for hiding this comment

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

Can we add something to the CI to ensure it keeps working?

@Berrysoft
Copy link
Contributor Author

Can we add something to the CI to ensure it keeps working?

It actually doesn't work all the time, because of bugs of cygwin. To be specific, the test unix hangs. Is it OK to ignore this test on cygwin and add a job to CI?

@Berrysoft
Copy link
Contributor Author

The maintainer of cygwin told me a workaround for the test unix. I have commited it.

@Berrysoft
Copy link
Contributor Author

@Thomasdezeeuw ping?

@Berrysoft
Copy link
Contributor Author

Could you review this PR again? @Thomasdezeeuw

@Berrysoft Berrysoft requested a review from Darksonn May 11, 2025 14:19
@Berrysoft
Copy link
Contributor Author

@Thomasdezeeuw @Darksonn Would you review again? This PR is the last blocker to build cargo on cygwin.

@Thomasdezeeuw
Copy link
Collaborator

@Thomasdezeeuw @Darksonn Would you review again? This PR is the last blocker to build cargo on cygwin.

I'm sorry to be blocking you, I've just been really busy lately and have very little spare time to review stuff (also see any pr on this repo). I'll try to give it a proper review again, but I can't promise anything.

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
```
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
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 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
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
```
@Berrysoft
Copy link
Contributor Author

@Thomasdezeeuw

I'm sorry to be blocking you, I've just been really busy lately and have very little spare time to review stuff...

Well, it's OK. Anyone has their busy time:)

It seems that you're the only active maintainer of this repo...? It's a little surprising because, I thought that the rust crates team should maintain such fundamental crate more actively:)

github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request May 19, 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/rust#140886
- [x] rust-lang/rust#140921
- [x] rust-lang/rust#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
```
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request May 19, 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/rust#140886
- [x] rust-lang/rust#140921
- [x] rust-lang/rust#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
```
src/sys/unix.rs Outdated
Comment on lines 1504 to 1505
/// Sets `SO_PEERCRED` to null on the socket.
/// It disables the initial handshake of unix domain sockets.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please improve the documentation for this. It should explain that normally cygwin performs an AF_LOCAL handshake when opening local sockets, and that this option turns off that cygwin extension. Also please include a link to the discussion thread about it.

It would also make sense to document on connect about this behavior. It's unfortunate that cygwin differs like this, but if that's how the OS works, then I'm not sure we can do much about it.

Choose a reason for hiding this comment

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

FYI, I have llvm/llvm-project#140353 for the same issue. It only seems to be a problem in the tests though (I think any real-world case would have at least separate threads if not processes involved, or they could use socketpair which takes care of getting both sides of the socket connected to each other at once)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, docs are added for set_no_peercred, connect and accept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants