Swift: macro plugin host fails with "Bad CPU type in executable" when tracing an Xcode 27 build on Apple Silicon
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- macos, swift
- 領域
- build-system, devtools
調査の方向性
Start with tools/osx64/preload_tracer and reproduce the failure using the provided codeql database create command on the SwiftData project. Compare how traced swift-frontend launches swift-plugin-server, using the reported arm64-only binaries and relocator output as evidence. Done means the traced Xcode build succeeds and creates the CodeQL database without the Bad CPU type error.
索引モデルが issue の本文から書いたものです。
説明
Description
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 fromtools/osx64/preload_tracer - macOS 27.0.1 on Apple M1 Pro
- Rosetta 2 installed
- Xcode 27.0 (27A266a), iOS 27 SDK
lipo -archsreportsarm64only for both of these:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/swift-plugin-server/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend
Steps to reproduce
- Use an iOS project containing any SwiftData
@Modelclass. - Put the build in a script,
build.sh:#!/bin/bash set -euo pipefail xcodebuild -project App.xcodeproj -scheme App -destination 'generic/platform=iOS Simulator' -derivedDataPath /tmp/dd-codeql CODE_SIGNING_ALLOWED=NO clean build - Run:
codeql database create /tmp/db --language=swift --overwrite --command=./build.sh
Expected behaviour
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"runsxcodebuildand printsXcode 27.0 / Build version 27A266a, and the plain build of the same project (without CodeQL) succeeds. So the failure seems specific to how the tracedswift-frontendlaunchesswift-plugin-server. - During the traced build, the relocator makes patched
.slice.arm64copies ofxcodebuild,SWBBuildService,actool,ibtooldandld. Each one logs aninstall_name_toolheader-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>"
- 主要言語
- CodeQL
- スター
- 10.2k
- フォーク
- 2.1k
- 平均マージ
- 2日 11時間
- マージ済み PR(30日)
- 155
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql のほかの issue
-
false-positive javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github/codeql#22632 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add AlertSuppression.ql for Rust (inline // codeql[...] suppression)対応中かも @cnuss が 193 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
github/codeql#21637 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
github/codeql#21076 · コメント 3 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
-
Rust: extraction succeeds with missing proc-macro output when the project's `rust-version` exceeds the forced toolchain対応中かも @paldepind が 3 日前に担当しました。 オープン
github/codeql#22793 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
needs-triage Platform(Default)
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
atlassian-labs/compiled#1960 ·
メンテナーはふだん 1 日以内に返信
-
Cached wheel reuse fails when the build and metadata fallback share an output directory対応中かも @harbinresearcher が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pypa/pyproject-hooks#240 · コメント 1 件 ·
-
status: team-only type: dependency-upgrade
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
spring-projects/spring-boot#52143 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 2 日以内に返信