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 support for Musl libc #2449

Merged
merged 5 commits into from
Jun 23, 2023
Merged

Add support for Musl libc #2449

merged 5 commits into from
Jun 23, 2023

Conversation

MaxDesiatov
Copy link
Member

Since Musl is sufficiently different from Glibc (see https://wiki.musl-libc.org/functional-differences-from-glibc.html), it requires a different import, which now should be applied to files that have import Glibc in them.

Since Musl is sufficiently different from Glibc (see https://wiki.musl-libc.org/functional-differences-from-glibc.html), it requires a different import, which now should be applied to files that have `import Glibc` in them.
@FranzBusch
Copy link
Member

Can we get some CI setup for this, otherwise I see us regressing really fast here. @MaxDesiatov is there any docker image we can use?

@MaxDesiatov
Copy link
Member Author

There's no Docker image right now as toolchain PRs aren't ready yet. I'm fine with this regressing until that's sorted out, I'm submitting this PR primarily to simplify local builds for development. Maintaining patches and branches manually across a dozen of repositories is unwieldy and I'd rather have these small changes merged ASAP so that iterating on the toolchain locally is easier.

@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Jun 23, 2023
@Lukasa Lukasa merged commit 43b1f59 into apple:main Jun 23, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/canimport-musl branch June 23, 2023 07:20
@finagolfin
Copy link
Contributor

There are some mistakes in this pull, which just broke my Android CI. Android uses #import Glibc, but since it's actually Bionic, there were places in NIO where it differentiated by using os(Linux) or os(Android), which some of these changes broke. The changes simply adding #if canImport(Glibc) before importing Glibc are fine, but some of the others are mistaken.

I will submit a pull correcting those later today.

finagolfin added a commit to finagolfin/swift-nio that referenced this pull request Jun 23, 2023
…if libc not found

Motivation

Fix build errors on Android

Modifications

- Fix previous Musl modifications that assumed Glibc wasn't imported on Android
- Add errors for all libc imports, so new platform ports error out early

Result

NIO builds natively on Android again, with all the same tests passing
Lukasa pushed a commit that referenced this pull request Jun 26, 2023
…bc not found (#2451)

Motivation

Fix build errors on Android

Modifications

- Fix previous Musl modifications that assumed Glibc wasn't imported on Android
- Add errors for all libc imports, so new platform ports error out early

Result

NIO builds natively on Android again, with all the same tests passing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants