Skip to content

Commit 754c808

Browse files
authored
[6.2] FreeBSD: Gate GNU-only API (#1194)
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 (cherry picked from commit 79c22ad) - **Explanation**: 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. - **Scope**: Build failure on platforms using Glibc modulemap that don't have GNU extensions. (FreeBSD, OpenBSD) - **Issues**: #1193 - **Original PRs**: #1183 - **Risk**: Low risk. Removes use of unavailable API. - **Testing**: Built swift-testing on FreeBSD and Linux. - **Reviewers**: @grynspan @3405691582 Fixes: #1193
1 parent 7751ca5 commit 754c808

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/Testing/ExitTests/SpawnProcess.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func spawnExecutable(
137137
// standardized in POSIX.1-2024 (see https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_spawn_file_actions_adddup2.html
138138
// and https://www.austingroupbugs.net/view.php?id=411).
139139
_ = posix_spawn_file_actions_adddup2(fileActions, fd, fd)
140-
#if canImport(Glibc)
140+
#if canImport(Glibc) && !os(FreeBSD) && !os(OpenBSD)
141141
if _slowPath(glibcVersion.major < 2 || (glibcVersion.major == 2 && glibcVersion.minor < 29)) {
142142
// This system is using an older version of glibc that does not
143143
// implement FD_CLOEXEC clearing in posix_spawn_file_actions_adddup2(),

Sources/Testing/Support/Versions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ let swiftStandardLibraryVersion: String = {
153153
return "unknown"
154154
}()
155155

156-
#if canImport(Glibc)
156+
#if canImport(Glibc) && !os(FreeBSD) && !os(OpenBSD)
157157
/// The (runtime, not compile-time) version of glibc in use on this system.
158158
///
159159
/// This value is not part of the public interface of the testing library.

0 commit comments

Comments
 (0)