Building with the latest development snapshot and the latest Xcode 16 Beta 5 with Explicitly Built Modules enabled results in build failures in the SDK header include file around unknown type name rsize_t.
This same error does not occur with Xcode 16 Beta 4.
This same error does not occur when Explicitly Built Modules is disabled (although we see another issue that is separately tracked by #75772)
This error does not occur when using the version of the Swift compiler bundled with Xcode 16 Beta 5.
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
Alternatively repro with a default template project: In Xcode 16 Beta 5 create a new default iOS Application project
go to “File -> New -> Project…”
Select the iOS Platform and the “App” template
Interface: Storyboard
Language: Swift
Testing System: None
Storage: None
Enable Explicitly Built Modules (_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES) build setting for the project
Enable it in the project settings, in the Swift Compiler - General settings (search for Explicitly Built Modules)
Build the app with Command-B or “Product -> Build”
Observe the build output
Expected behavior
Expected the build to succeed with the latest open source compiler development snapshot, the latest Xcode beta, and Explicitly Built Modules enabled.
Environment
macOS Sonoma 14.5 (23F79)
Xcode Version 16.0 beta 5 (16A5221g)
Swift 6.0 Development Snapshot 2024-08-08 (a)
Additional information
Testing with Explicitly Built Modules (_EXPERIMENTAL_SWIFT_EXPLICIT_MODULES) set to NO results in an assertion failure tracked by https://github.com/swiftlang/swift/issues/75772, but does not show the size_t/rsize_t build issue.
There are 6 files that were changed in the iPhoneSimulator 18.0 sdk in Xcode 16 beta 5, specifically around how certain types including rsize_t are defined. This newly introduced USE_CLANG_STDDEF is likely related to the issue, but it’s not clear how the bundled version of the swift compiler handles this while the open source development snapshots don’t handle it.
Description
rsize_t
.Build failure snippet from Xcode:
Full build errror: Build ExplicitModulesTestApp_2024-08-09T11-50-02.txt
Reproduction
Expected behavior
Environment
Additional information