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

[SR-12177] swift-corelibs-foundation doesn't run in Xcode using snapshot toolchains #3271

Open spevans opened 4 years ago

spevans commented 4 years ago
Previous ID SR-12177
Radar rdar://problem/59496020
Original Reporter @spevans
Type Bug
Environment macOS 10.15.3 Xcode 11.3.1, 11.4 (beta)
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: ec29f3810e07302629468489d098f6be

Issue Description:

Running TestFoundation in Xcode using a snapshot toolchain eg swift-swift-DEVELOPMENT-SNAPSHOT-2020-02-08-a-osx results in a runtime error although it compiles and builds successfully.

I believe this ultimately due to the version check performed in swift::_swift_stdlib_operatingSystemVersion which ends up calling directly into CoreFoundation without __CFInitialize() being called first. This is most likely due to how CoreFoundation is built as part of the swift-corelibs-foundation such that its constructor doesnt call this function.

Using the default Xcode toolchains works without issue.

beccadax commented 4 years ago

@swift-ci create

xwu commented 3 years ago

Dropping in here to note that this bug makes it no longer possible to work with the overlay and the open-source implementation simultaneously since the adoption of @_spi(Foundation) in the overlay, which deliberately requires the use of a snapshot toolchain to build. This is particularly unfortunate as (a) these two projects are part of the same repo yet ToT can't be built with a single toolchain; and (b) it's actively desirable to keep these two projects in sync but the use of @_spi in conjunction with this bug throws up a barrier to that.

waterskier2007 commented 2 years ago

Using the default Xcode toolchains works without issue.

I am using Xcode 13.3.1 and encountering issues building the SwiftFoundation target from corelibs foundation, following the Getting Started guide. They are quite confusing as some steps mention using the latest snapshot, but then there are notes stating to use the current Xcode version.

What's the current guidance?