You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Swift: macro plugin host fails with "Bad CPU type in executable" when tracing an Xcode 27 build on Apple Silicon #22742
Creating a Swift database for an iOS app that uses SwiftData macros (@Model, #Predicate) fails on an Apple Silicon Mac with Xcode 27. swift-frontend runs under the tracer, but it cannot launch the macro plugin host, so every macro expansion fails and the build stops.
Environment
CodeQL CLI 2.27.1 (Homebrew cask codeql); the tracer runs from tools/osx64/preload_tracer
The database is created. Running ./build.sh without CodeQL ends in ** BUILD SUCCEEDED **.
Actual behaviour
The build fails with exit code 65. Every file using a SwiftData macro reports:
error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; compiler plugin '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/swift-plugin-server' could not be loaded: Bad CPU type in executable
Related observations
Without the macro plugin, the tracer copes with the arm64-only toolchain. A probe with --command="xcodebuild -version" runs xcodebuild and prints Xcode 27.0 / Build version 27A266a, and the plain build of the same project (without CodeQL) succeeds. So the failure seems specific to how the traced swift-frontend launches swift-plugin-server.
During the traced build, the relocator makes patched .slice.arm64 copies of xcodebuild, SWBBuildService, actool, ibtoold and ld. Each one logs an install_name_tool header-padding error and then falls back to a short symlink, after which tracing continues normally. I include this in case it's related:
error: .../install_name_tool: changing install names or rpaths can't be redone for: .../xcodebuild.semmle.<id>.slice.arm64 (for architecture arm64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
relocator: resorting to replacing "/Applications/Xcode.app/Contents/Developer/usr/bin" with short symlink "/tmp/<random>"
Hey @nicktoumpelis, I work on the product team and wanted to post a quick update regarding this situation.
CodeQL scans that trace a build are affected by compatibility changes in macOS 27 and Xcode 27: Apple has removed intel compatible binaries that CodeQL’s build tracer relies on. Build-tracing is how we extract information about the code when scanning Swift applications. As Swift 6.4 is tied to Xcode 27, we are unable to provide support for this version.
For Swift 6.3 and earlier versions the only available workaround we have is to use a runner/machine with macOS 26 or earlier and Xcode 26 or earlier.
We are currently working on a new version of the Swift scanner, which will be cross-platform, and will be able to handle the latest versions of MacOS, Xcode and Swift.
Activity
nicktoumpelis commentedon Oct 2, 2026
Opened with the wrong template. This is a bug report, not a question. Could a maintainer relabel it?
jketema commentedon Oct 2, 2026
Hi @nicktoumpelis,
We are aware of this and are having some discussions around this internally. We'll try to post an update as soon as possible.
nicktoumpelis commentedon Oct 2, 2026
Thank you @jketema!
coadaflorin commentedon Oct 2, 2026
Hey @nicktoumpelis, I work on the product team and wanted to post a quick update regarding this situation.
CodeQL scans that trace a build are affected by compatibility changes in macOS 27 and Xcode 27: Apple has removed intel compatible binaries that CodeQL’s build tracer relies on. Build-tracing is how we extract information about the code when scanning Swift applications. As Swift 6.4 is tied to Xcode 27, we are unable to provide support for this version.
For Swift 6.3 and earlier versions the only available workaround we have is to use a runner/machine with macOS 26 or earlier and Xcode 26 or earlier.
We are currently working on a new version of the Swift scanner, which will be cross-platform, and will be able to handle the latest versions of MacOS, Xcode and Swift.
nicktoumpelis commentedon Oct 2, 2026
Thanks for the update @coadaflorin!
Pause the CodeQL Swift job until it supports Xcode 27. CodeQL's build…
Pause the CodeQL Swift job until it supports Xcode 27. CodeQL's build…
CodeQL: one workflow for actions, C and C++, JavaScript, Python and S…
ci(codeql): pause the Swift scan until CodeQL supports Xcode 27
Set up protected contributions, security scanning and Apache licensing (