Description
Description
Swift-Testing fails to build on FreeBSD due to usage of unguarded GNU extensions.
FreeBSD, OpenBSD, and everything Unix-y that isn't Android or Apple uses the glibc module map for importing the C library. This means that canImport(Glibc)
is not sufficient for guarding GNU extensions.
/home/ewilde/Work/Swift-Project/swift-testing/Sources/Testing/Support/Versions.swift:163:29: error: cannot find '__GLIBC__' in scope
161 | // Default to the statically available version number if the function call
162 | // fails for some reason.
163 | var major = Int(clamping: __GLIBC__)
| `- error: cannot find '__GLIBC__' in scope
164 | var minor = Int(clamping: __GLIBC_MINOR__)
165 |
/home/ewilde/Work/Swift-Project/swift-testing/Sources/Testing/Support/Versions.swift:164:29: error: cannot find '__GLIBC_MINOR__' in scope
162 | // fails for some reason.
163 | var major = Int(clamping: __GLIBC__)
164 | var minor = Int(clamping: __GLIBC_MINOR__)
| `- error: cannot find '__GLIBC_MINOR__' in scope
165 |
166 | if let strVersion = gnu_get_libc_version() {
/home/ewilde/Work/Swift-Project/swift-testing/Sources/Testing/Support/Versions.swift:166:23: error: cannot find 'gnu_get_libc_version' in scope
164 | var minor = Int(clamping: __GLIBC_MINOR__)
165 |
166 | if let strVersion = gnu_get_libc_version() {
| `- error: cannot find 'gnu_get_libc_version' in scope
167 | withUnsafeMutablePointer(to: &major) { major in
168 | withUnsafeMutablePointer(to: &minor) { minor in
Reproduction
swift build
Expected behavior
it builds
Environment
Swift-Testing checkout: c171888
FreeBSD 14.3-RELEASE FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC arm64
Swift version 6.2-dev (LLVM 983d4c29b28d5cd, Swift 7460ce1c7230afc)
Target: aarch64-unknown-freebsd14.3
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done