Skip to content

<unknown>:0: error: missing required module '_SwiftSyntaxCShims' #9242

@vsarunas

Description

@vsarunas

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

We have a build plugin that builds the required products; in CI when a clean repo is checked out with no .build, something will be different and checked out code won't be buildable:

$ swift package --disable-sandbox sdk-build --skip-build --verbose
[...]
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: missing required module '_SwiftSyntaxCShims'

After that even swift build will fail:

$  swift build --verbose
[...]
/Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/IntegerTricks/autogenerated/FixedWidthInteger+roundUpToPowerOfTwo.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/IntegerTricks/autogenerated/Integer rank.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/IntegerTricks/autogenerated/UInt+first and last set bit.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/IntegerTricks/autogenerated/UInt+reversed.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet+Index.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet+_Word.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/UnsafeBitSet/autogenerated/_UnsafeBitSet.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/_SortedCollection.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/_UniqueCollection.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/Debugging.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/Descriptions.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/RandomAccessCollection+Offsets.swift -primary-file /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeBufferPointer+Extras.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableRawBufferPointer+Extras.swift /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/checkouts/swift-collections/Sources/InternalCollectionsUtilities/autogenerated/UnsafeRawBufferPointer+Extras.swift -emit-dependencies-path /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/InternalCollectionsUtilities.build/UnsafeBufferPointer+Extras.d -emit-reference-dependencies-path /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/InternalCollectionsUtilities.build/UnsafeBufferPointer+Extras.swiftdeps -serialize-diagnostics-path /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/InternalCollectionsUtilities.build/UnsafeBufferPointer+Extras.dia -target arm64-apple-macosx10.13 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -I /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/Modules -I /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -F /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -color-diagnostics -Xcc -fcolor-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/ModuleCache -suppress-warnings -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -D SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE -D COLLECTIONS_RANDOMIZED_TESTING -new-driver-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -enable-experimental-feature AvailabilityMacro=SwiftStdlib 5.0: macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 5.1: macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 5.6: macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 5.8: macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 5.9: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 5.10: macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 6.0: macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 6.1: macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4 -enable-experimental-feature AvailabilityMacro=SwiftStdlib 6.2: macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0 -enable-upcoming-feature MemberImportVisibility -enable-experimental-feature BuiltinModule -enable-experimental-feature Lifetimes -enable-experimental-feature InoutLifetimeDependence -enable-experimental-feature SuppressedAssociatedTypes -empty-abi-descriptor -plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins/testing -user-module-version 1.3.0 -enable-anonymous-context-mangled-names -file-compilation-dir /Users/runner/actions-runner/_work/package-data-model/package-data-model -Xcc -isysroot -Xcc /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -Xcc -F -Xcc /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -F -Xcc /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/PrivateFrameworks -Xcc -fPIC -Xcc -g -no-auto-bridging-header-chaining -module-name InternalCollectionsUtilities -package-name swift_collections -disable-clang-spi -target-sdk-version 26.0 -target-sdk-name macosx26.0 -external-plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-26.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -in-process-plugin-server-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-26.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/InternalCollectionsUtilities.build/UnsafeBufferPointer+Extras.swift.o -index-store-path /Users/runner/actions-runner/_work/package-data-model/package-data-model/.build/arm64-apple-macosx/debug/index/store -index-system-modules
/Users/runner/actions-runner/_work/package-data-model/package-data-model/Local/OrdoEssentials/Sources/Macros/CFI.swift:1:8: error: missing required module '_SwiftSyntaxCShims'

swift-syntax is correctly extracted:

du -sh .build/prebuilts/swift-syntax/602.0.0/*
 59M	.build/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-MacroSupport-macos_aarch64
 13M	.build/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-MacroSupport-macos_aarch64.zip
 12K	.build/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-manifest.json

du -sk ~/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-*
12908	/Users/runner/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-MacroSupport-macos_aarch64.zip

This machine has:

sha256sum ~/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-*
a1cd8f0289fd157e86316246d4e6160229c6c2cfeb06b25af6043a6a49573044  /Users/runner/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-MacroSupport-macos_aarch64.zip
d9719016ca233fd8667dc87bc36460089913d98a5f54105749ae059b8e8f2235  /Users/runner/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-manifest.json

My machine has:

49f745a25a972123fd17b72599a305efbabe6986b848e5cecd16acd9c9140b75  /Users/sarunas/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-MacroSupport-macos_aarch64.zip
6ca25fbdfa7d71302bbef6e61eb731b66c36119afa33912e0b403fe7b99265f4  /Users/sarunas/Library/Caches/org.swift.swiftpm/prebuilts/swift-syntax/602.0.0/swiftlang-6.2.0.19.9-manifest.json

If I remove the cache, new files are downloaded with matching checksums, but I'm able to build fine locally.
Why do the checksums change for the same version?

a1cd8f0289fd157e86316246d4e6160229c6c2cfeb06b25af6043a6a49573044  swiftlang-6.2.0.19.9-MacroSupport-macos_aarch64.zip
d9719016ca233fd8667dc87bc36460089913d98a5f54105749ae059b8e8f2235  swiftlang-6.2.0.19.9-manifest.json

On the CI machine if I trigger SPM update, it will compile fine, but SwiftSyntax will be built:

rm -rf .build
swift package update
swift package --disable-sandbox sdk-build --skip-build --verbose
[....]
[65/111] Compiling SwiftSyntax SyntaxNodeStructure.swift

The compilation error started to happen a few days ago.

Expected behavior

Use SwiftSyntax pre-compiled and do not fail to build

Actual behavior

Compilation error

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx26.0

Darwin mini7-osx-ci.local 25.0.0 Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:53 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T8112 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions