Skip to content

Cxx and CxxStdlib built for iOS 16.0 and above only #77909

@drodriguez

Description

@drodriguez

Description

Cxx.swiftmodule and CxxStdlib.swiftmodule in recent nightlies of Swift.org and Xcode 16.2 betas seems to only be built for iOS 16.0 and above.

Reproduction

With Xcode 16.2 beta 3:

  1. Download Apple example code in https://developer.apple.com/documentation/swift/mixinglanguagesinanxcodeproject
  2. Open in Xcode 16.2 beta 3 (install iOS SDK).
  3. In the project settings, in Signing and Certificates, choose a team.
  4. In the project settings, in Build Settings, change the "Base SDK" to iOS.
  5. Same place, change the "iOS deployment target" to iOS 15 (minimum allowed by the UI)
  6. Build the target "Swift-and-Cplusplus-mixed-FibonacciFramework"

Downloading Swift.org nightlies seems to reproduce the problem as well, but only since 2024-10-08 nightlies in the swift-6.0 branch.

Good: swift-6.0-DEVELOPMENT-SNAPSHOT-2024-09-17-a
Bad: swift-6.0-DEVELOPMENT-SNAPSHOT-2024-10-08-a
Also bad: swift-6.0-DEVELOPMENT-SNAPSHOT-2024-11-05-a (last available)

Expected behavior

In Xcode 16.1 and Xcode 16.0 the previous code sample compiled without any problems.

Environment

Reproducible with several toolchains:

  • Xcode 16.2 beta 3
  • swift-6.0-DEVELOPMENT-SNAPSHOT-2024-10-08-a
  • swift-6.0-DEVELOPMENT-SNAPSHOT-2024-11-05-a

Additional information

I think the commit that introduced the problem might be b87b263, or at least the timeline of nightlies seems to points to it, and the change seems to match the symptoms. In Xcode 16.1, the Cxx.swiftmodule/arm64e-apple-ios.swiftmodule file has the following entry (dump from llvm-bcanalyzer):

<TARGET abbrevid=6/> blob data = 'arm64e-apple-ios11.0'

While the same file in Xcode 16.2b3 has the following:

<TARGET abbrevid=6/> blob data = 'arm64e-apple-ios16.0'

I think that Cxx.swiftmodule seems to "underspecify" its deployment version for anything but macOS in https://github.com/swiftlang/swift/blob/main/stdlib/public/Cxx/CMakeLists.txt#L28 ends up using the default SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS.

It also might be related to Cxx not being resilient or not distributing .swiftinterface files.

I wrote asking about this in the Slack #cxx-interop channel. I will try to hang out there to answer questions.

We opened FB16023505 as well.

Metadata

Metadata

Assignees

Labels

CxxArea → standard library: The `Cxx` modulebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++cmakeplatform supportswift 6.0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions