Add support for FreeBSD and OpenBSD#387
Conversation
|
OpenBSD post 7.8 also needs the following changes, but otherwise swift-log compiles with this patch. Do you mind integrating this and rebasing? |
|
Yes, sure. |
|
@3405691582 I've added those changes. Thank you for your suggestions! |
|
I've been using this successfully via var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-log", branch: "pull/387/head"),
] |
ktoso
left a comment
There was a problem hiding this comment.
While we don't have CI for this platform seems folks used this successfully... we can always keep updating if it happened to be slightly off
|
Sorry this is taking a while to integrate -- would you mind rebasing? I don't have a freebsd at hand to verify I'll get the changes right |
|
@ktoso I've resolved the conflict with a92ccc6. Also, I found that a92ccc6 was broken on OpenBSD because it was using uninitialized swift-log/Sources/Logging/Locks.swift Line 75 in 0d9c9ae Finally, I verified that my changes were appropriate using $ freebsd-version
15.0-RELEASE-p1
$ uname -a
FreeBSD Coconut-rhinoceros-beetle 15.0-RELEASE-p1 FreeBSD 15.0-RELEASE-p1 releng/15.0-n280999-7bceec30b351 GENERIC amd64
$ swift --version
Swift version 6.3-dev (LLVM b58b2a34d509492, Swift cf535d8b998d09b)
Target: x86_64-unknown-freebsd14.3
Build config: +assertions
$ swift test
[1/1] Planning build
Building for debugging...
[41/41] Linking swift-logPackageTests.xctest
Build complete! (6.41s)
Test Suite 'All tests' started at 2026-01-15 22:13:08.972
Test Suite 'debug.xctest' started at 2026-01-15 22:13:09.007
Test Suite 'debug.xctest' passed at 2026-01-15 22:13:09.007
Executed 0 tests, with 0 failures (0 unexpected) in 0.0 (0.0) seconds
Test Suite 'All tests' passed at 2026-01-15 22:13:09.007
Executed 0 tests, with 0 failures (0 unexpected) in 0.0 (0.0) seconds
◇ Test run started.
↳ Testing Library Version: 6.3-dev (98430f2d6cb8d81)
↳ Target Platform: x86_64-unknown-freebsd
◇ Suite GlobalLoggerTest started.
◇ Suite MDCTest started.
◇ Suite SendableTest started.
◇ Suite MetadataProviderTest started.
◇ Suite LocalLoggerTest started.
◇ Suite CompatibilityTest started.
◇ Suite InMemoryLogHandlerTests started.
◇ Suite LoggingTest started.
...
✔ Suite GlobalLoggerTest passed after 0.307 seconds.
✔ Test run with 57 tests in 8 suites passed after 0.307 seconds. |
|
The |
This PR adds support for FreeBSD to the `CNIOSHA1` target and the `NIOConcurrencyHelpers` target. ### Motivation: This PR is partial because the `NIOCore` target still can't be built, and the existing PR #3398 includes almost the same changes too. However, #3398 is a little bit old. Besides, the source code in `NIOConcurrencyHelpers` is used in other repositories now, for example: - apple/swift-log#398 - apple/swift-log#387 was merged before swift-nio is fixed. So I think it's important to fix `NIOConcurrencyHelpers` first, even if the entire swift-nio is yet to be fixed. ### Modifications: - Make `swift build --target NIOConcurrencyHelpers` work on FreeBSD - Make `swift build --target CNIOSHA1` work on FreeBSD ### Result: The following commands finished successfully. ```shell swift build --target NIOConcurrencyHelpers swift build --target CNIOSHA1 ``` Environment: - FreeBSD 15.0-RELEASE-p1 x86_64 - [Swift on FreeBSD Preview toolchain](https://forums.swift.org/t/swift-on-freebsd-preview/83064) ``` Swift version 6.3-dev (LLVM b58b2a34d509492, Swift cf535d8b998d09b) Target: x86_64-unknown-freebsd14.3 Build config: +assertions ``` --------- Co-authored-by: Cory Benfield <lukasa@apple.com>
I've added support for FreeBSD. I've only tested this PR on FreeBSD, but I believe it should also work on OpenBSD.
Motivation:
closes #372
Also, Swift on FreeBSD preview toolchain is now available.
Modifications:
Glibc.stdoutandGlibc.stderrfor *BSD because they are non-optional on *BSDResult:
swift-log and packages depending on it will be usable on FreeBSD.
Checks:
I tested it with
swift buildandswift test. All tests have passed.Environment:
Swift toolchain is from https://forums.swift.org/t/swift-on-freebsd-preview/83064.