Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mavitalemeta opened this issue Aug 9, 2024 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@mavitalemeta
Copy link

mavitalemeta commented Aug 9, 2024

Description

  • 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 Every package with Xcode + snapshot is crashing the compiler in the same way #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

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

  • 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 Every package with Xcode + snapshot is crashing the compiler in the same way #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.
    • iPhoneSimulator18.0.sdk/usr/include/sys/_types/_ptrdiff_t.h
    • iPhoneSimulator18.0.sdk/usr/include/sys/_types/_rsize_t.h
    • iPhoneSimulator18.0.sdk/usr/include/sys/_types/_wchar_t.h
    • iPhoneSimulator18.0.sdk/usr/include/sys/_types/_null.h
    • iPhoneSimulator18.0.sdk/usr/include/sys/_types/_size_t.h
    • iPhoneSimulator18.0.sdk/usr/include/sys/_types/_offsetof.h
@mavitalemeta mavitalemeta added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Aug 9, 2024
@NuriAmari
Copy link
Contributor

Should be fixed by llvm/llvm-project#102239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants