swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

can’t run TestFoundation target in swift-corelibs-foundation repository #4608

Open kaijiemu opened 2 years ago

kaijiemu commented 2 years ago

I am starting contributing Swift Foundation framework. I am using swift-corelibs-foundation repository by following this guide: swift-corelibs-foundation/GettingStarted.md at main · apple/swift-corelibs-foundation · GitHub 6

But it is failed when I try to run TestFoundation: image image

What can I do about it?Thanks

YOCKOW commented 2 years ago

Unfortunately, there are bugs to build TestFoundation on macOS. Not only SR-12177, but also...

also cannot be compiled with the default toolchain, since String.swift uses the @_spi feature to call String(_cocoaString:) and compiling with the default toolchain does not expose the required API.

https://forums.swift.org/t/ci-not-testing-foundation-overlay/51595.

YOCKOW commented 2 years ago

Ah, it's worse than I expected. The reason why kCF*s become ambiguous is because Xcode is trying to load modulemaps of CoreFoundation twice: the one in Xcode's SDK and the repo's one. It seems that this problem occurs no matter which toolchain is used.

Fidetro commented 2 years ago

I have successfully compiled SwiftFoundation, and then encountered the same error. I have tried the methods mentioned here https://forums.swift.org/t/cant-run-testfoundation-target-in-swift-corelibs-foundation-repository/50360/7, but still can't solve

Does this problem still exist?

parkera commented 4 months ago

This is one of the reasons we decided we couldn't really support building the swift-corelibs-foundation module for macOS -- there is just an unresolvable ambiguity with the system frameworks. XCTest, for example, winds up causing a cycle.