Skip to content

FreeBSD: Gate GNU-only API #1183

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 1 commit into
base: main
Choose a base branch
from

Conversation

etcwilde
Copy link
Member

The FreeBSD builds are currently using the GlibC modulemap to import the C runtimes. FreeBSD does not have gnu_get_libc_version resulting in build failures.

The use of this API was introduced in #1147

The FreeBSD builds are currently using the GlibC modulemap to import the
C runtimes. FreeBSD does not have `gnu_get_libc_version` resulting in
build failures.
Copy link
Contributor

@grynspan grynspan left a comment

Choose a reason for hiding this comment

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

I thought the module was supposed to be named FreeBSD since they don't use Glibc? Ah well.

@grynspan grynspan added bug 🪲 Something isn't working workaround Workaround for an issue in another component (may need to revert later) exit-tests ☠️ Work related to exit tests freebsd 😈 FreeBSD support attachments/activities 🖇️ Work related to attachments and/or activities labels Jun 27, 2025
@grynspan grynspan added this to the Swift 6.x (main) milestone Jun 27, 2025
@grynspan
Copy link
Contributor

@swift-ci test

@etcwilde
Copy link
Member Author

I thought the module was supposed to be named FreeBSD since they don't use Glibc? Ah well.

Yes, we should create a new module and module map for FreeBSD and call it something else, but since everything piggybacks on the Glibc module map, it was convenient to avoid re-writing the #if canImport(<insert libc here>) chains across the project.

@@ -136,7 +136,7 @@ func spawnExecutable(
// standardized in POSIX.1-2024 (see https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_spawn_file_actions_adddup2.html
// and https://www.austingroupbugs.net/view.php?id=411).
_ = posix_spawn_file_actions_adddup2(fileActions, fd, fd)
#if canImport(Glibc)

Choose a reason for hiding this comment

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

Add !OpenBSD while you're add it? SwiftTesting also has a bunch of existing OpenBSD conditionals.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've attempted to support OpenBSD but it's entirely untested. It's unclear to me if it would have a module named Glibc (its stdlib is not GNU.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attachments/activities 🖇️ Work related to attachments and/or activities bug 🪲 Something isn't working exit-tests ☠️ Work related to exit tests freebsd 😈 FreeBSD support workaround Workaround for an issue in another component (may need to revert later)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants