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

Add cygwin support #4279

Merged
merged 1 commit into from
Mar 7, 2025
Merged

Add cygwin support #4279

merged 1 commit into from
Mar 7, 2025

Conversation

Berrysoft
Copy link
Contributor

Description

rust-lang/rust#134999

Most changes are ported from https://github.com/ookiineko-cygport/libc

Sources

https://github.com/cygwin/cygwin/tree/main/winsup/cygwin/include

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

I'm not sure how to test a no_std target. Actually I need these changes to implement std for cygwin target.

@rustbot
Copy link
Collaborator

rustbot commented Feb 22, 2025

r? @tgross35

rustbot has assigned @tgross35.
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

@Berrysoft
Copy link
Contributor Author

Stable compilers failed because cygwin target is only supported by nightly ones nowadays. Are there some ways to solve this problem?

@tgross35
Copy link
Contributor

Stable compilers failed because cygwin target is only supported by nightly ones nowadays. Are there some ways to solve this problem?

If it's just check-cfg failing, then it needs an update in

libc/build.rs

Line 25 in 3695157

const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Most of this looks pretty good but there are a handful of changes to get this more in line with the other OSs.

Does cygwin only ever use newlib, or are there other libc implementations?

@Berrysoft Berrysoft requested a review from tgross35 February 26, 2025 16:20
@mati865
Copy link
Contributor

mati865 commented Feb 26, 2025

AFAIK Nnwlib is the only one ported.

@Berrysoft
Copy link
Contributor Author

Newlib is the only libc on cygwin, but some definitions are replaced, e.g., signal-related structures.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

I did a more thorough read through of everything here, I did not check the definitions for correctness but everything looks pretty good for implementation. I have a handful of small requests then this should be good to merge.

Please squash after these changes are done.

Co-authored-by: Ookiineko <[email protected]>
@Berrysoft
Copy link
Contributor Author

The windows CI failed because the self-update command of rustup failed. I have also met this problem in my other repos, and it's not caused by this PR.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates, everything looks good. Looks like CI is going again.

@tgross35 tgross35 enabled auto-merge March 6, 2025 08:15
@Berrysoft
Copy link
Contributor Author

Thank you! I don't understand why the arm64 android CI failed. Maybe a rerun would be fine?

@tgross35
Copy link
Contributor

tgross35 commented Mar 6, 2025

Android is just flaky #4297, restarted

@Berrysoft
Copy link
Contributor Author

I see. It reached the timeout (25 minutes) and was cancelled again.

@tgross35 tgross35 added this pull request to the merge queue Mar 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 6, 2025
@tgross35 tgross35 added this pull request to the merge queue Mar 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 6, 2025
@tgross35 tgross35 added this pull request to the merge queue Mar 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 6, 2025
@tgross35 tgross35 added this pull request to the merge queue Mar 6, 2025
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Mar 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 6, 2025
@tgross35 tgross35 added this pull request to the merge queue Mar 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 7, 2025
@tgross35 tgross35 added this pull request to the merge queue Mar 7, 2025
Merged via the queue into rust-lang:main with commit b29fa71 Mar 7, 2025
46 checks passed
@tgross35
Copy link
Contributor

tgross35 commented Mar 7, 2025

The windows CI failed because the self-update command of rustup failed. I have also met this problem in my other repos, and it's not caused by this PR.

Fwiw things still seem broken, passing --no-self-update corrected the issue.

@Berrysoft Berrysoft deleted the dev/cygwin-main branch March 7, 2025 12:42
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Mar 10, 2025
Co-authored-by: Ookiineko <[email protected]>

(backport <rust-lang#4279>)
(cherry picked from commit f5569b1)
@tgross35 tgross35 mentioned this pull request Mar 10, 2025
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Mar 10, 2025
Co-authored-by: Ookiineko <[email protected]>

(backport <rust-lang#4279>)
(cherry picked from commit f5569b1)
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Mar 10, 2025
@tgross35
Copy link
Contributor

This is in the latest release fyi https://github.com/rust-lang/libc/releases/tag/0.2.171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-unix S-waiting-on-review stable-applied This PR has been cherry-picked to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants