Skip to content

Additional FreeBSD fixes#865

Merged
grynspan merged 3 commits into
swiftlang:mainfrom
michael-yuji:freebsd-wip
Dec 18, 2024
Merged

Additional FreeBSD fixes#865
grynspan merged 3 commits into
swiftlang:mainfrom
michael-yuji:freebsd-wip

Conversation

@michael-yuji

@michael-yuji michael-yuji commented Dec 18, 2024

Copy link
Copy Markdown
Member

Add FreeBSD support for swift-testing.

Result:

With this PR, swift-testing can be built on FreeBSD (tested on x86_64 FreeBSD 14.1-RELEASE-p6)

Known issue:

There are some issue running swift test on this repo, but most likely due to bugs in my host toolchain.

  • Tests failed to link due to duplicated main symbols:
error: link command failed with exit code 1 (use -v to see invocation)
ld: error: duplicate symbol: main
>>> defined at TestingMacrosMain.swift:0 (/zdata/swift-main/swift-project/swift-testing/Sources/TestingMacros/TestingMacrosMain.swift:0)
>>>            /zdata/swift-main/swift-project/swift-testing/.build/x86_64-unknown-freebsd14.1/debug/TestingMacros-tool.build/TestingMacrosMain.swift.o:(main)
>>> defined at runner.swift:0 (/zdata/swift-main/swift-project/swift-testing/.build/x86_64-unknown-freebsd14.1/debug/swift-testingPackageTests.derived/runner.swift:0)
>>>            /zdata/swift-main/swift-project/swift-testing/.build/x86_64-unknown-freebsd14.1/debug/swift_testingPackageTests-tool.build/runner.swift.o:(.text.main+0x0)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[25/26] Linking swift-testingPackageTests.xctest
  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

Comment thread Sources/Testing/ExitTests/SpawnProcess.swift
Comment thread Sources/Testing/ExitTests/WaitFor.swift Outdated
Comment thread Sources/Testing/Support/Locked.swift Outdated
Comment thread Sources/_TestingInternals/include/Includes.h
Comment thread Sources/Testing/ExitTests/ExitTest.swift Outdated
@grynspan grynspan changed the title add FreeBSD support Additional FreeBSD fixes Dec 18, 2024
@grynspan grynspan added bug 🪲 Something isn't working freebsd 😈 FreeBSD support labels Dec 18, 2024
@grynspan grynspan added this to the Swift 6.x milestone Dec 18, 2024
@grynspan

Copy link
Copy Markdown
Contributor

Thanks for taking a look at this! I've left you some questions.

@grynspan

Copy link
Copy Markdown
Contributor

Some tests failed to build (due to missing openpty)

FreeBSD has the openpty() function. Is there a missing #include in _TestingInternals that we can add?

@grynspan

Copy link
Copy Markdown
Contributor

@swift-ci test

@michael-yuji

michael-yuji commented Dec 18, 2024

Copy link
Copy Markdown
Member Author

Some tests failed to build (due to missing openpty)

FreeBSD has the openpty() function. Is there a missing #include in _TestingInternals that we can add?

This is the weird part. openpty supposed to be in libutil.h, but for some reason even if I added libutil.h to _TestingItnernals Includes.h the compiler still couldn't see the symbol and I don't know why.

Hey! turns out it's because I made a typo. This is now fixed too.

@grynspan

Copy link
Copy Markdown
Contributor

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor

@swift-ci test

@grynspan grynspan merged commit 014d874 into swiftlang:main Dec 18, 2024
@grynspan

Copy link
Copy Markdown
Contributor

Related: swiftlang/swift#77836

@michael-yuji

Copy link
Copy Markdown
Member Author

Related: swiftlang/swift-package-manager#8193
The above swiftpm PR should've fix the duplicated symbol error for Functional Tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working freebsd 😈 FreeBSD support

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants