swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.33k forks source link

Swift 6.0 development snapshots fail to build with Xcode 16 Beta 5 when explicitly built modules are enabled #75813

Closed mavitalemeta closed 2 weeks ago

mavitalemeta commented 1 month ago

Description

Build failure snippet from Xcode:

2 errors generated.
/Applications/Xcode_16.0.0_16A5221g_fb.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/_string.h:145:54: error: unknown type name 'rsize_t'; did you mean 'size_t'?
143 | 
144 | __BEGIN_DECLS
145 | errno_t   memset_s(void *__s, rsize_t __smax, int __c, rsize_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
    |                                                      `- error: unknown type name 'rsize_t'; did you mean 'size_t'?
146 | __END_DECLS
147 | #endif

/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-08-a.xctoolchain/usr/lib/swift/clang/include/__stddef_size_t.h:18:23: note: 'size_t' declared here
16 | #define _SIZE_T
17 | 
18 | typedef __SIZE_TYPE__ size_t;
   |                       `- note: 'size_t' declared here
19 | 
20 | #endif

Full build errror: Build ExplicitModulesTestApp_2024-08-09T11-50-02.txt

Reproduction

  1. Install Xcode 16 Beta 5
  2. Install the latest development snapshot package for macOS
    1. As of this writing, this is the “Swift 6.0 Development Snapshot 2024-08-08 (a)” toolchain from https://www.swift.org/install/macos/
  3. Choose the development snapshot toolchain in Xcode
    1. “Xcode -> Toolchains -> Swift 6.0 Development Snapshot 2024-08-08 (a)”
  4. Open the attached Xcode project at ExplicitlyBuiltModulesProject.zip
    1. Alternatively repro with a default template project: In Xcode 16 Beta 5 create a new default iOS Application project
      1. go to “File -> New -> Project…”
      2. Select the iOS Platform and the “App” template
      3. Interface: Storyboard
      4. Language: Swift
      5. Testing System: None
      6. Storage: None
      7. Enable Explicitly Built Modules (_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES) build setting for the project
        1. Enable it in the project settings, in the Swift Compiler - General settings (search for Explicitly Built Modules)
  5. Build the app with Command-B or “Product -> Build”
  6. Observe the build output

Expected behavior

Environment

Additional information

NuriAmari commented 1 month ago

Should be fixed by https://github.com/llvm/llvm-project/pull/102239