Release builds fail on macOS 27: Rust 1.95 strips proc-macro dylibs with misaligned __LINKEDIT (fixed in Rust 1.98)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 80/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- macos, rust
- 領域
- build-system
調査の方向性
修正は、リポジトリルートの rust-toolchain.toml の channel に対する1行の変更で、pin を 1.95.0 から 1.98.0 以降に上げるものです(1.99.0 が現在の安定版です)。macOS 27 で cargo build --release -p buzz-db を使用して検証してください。以前は mis-aligned LINKEDIT dlopen エラーで失敗していましたが、sqlx-macros dylib のロードが成功のシグナルです。まず #8049 を確認してください。これは Hermit 管理のツールをアップグレードする一方で pin を 1.95.0 のままにしているため、競合する可能性があります。
索引モデルが issue の本文から書いたものです。
説明
Summary
On macOS 27, cargo build --release of any crate that uses sqlx macros fails with the pinned Rust 1.95.0 toolchain. The cause is a known LLVM bug that is already fixed in Rust 1.98.0, so bumping rust-toolchain.toml to 1.98 or later resolves it. (#8049 upgrades the Hermit-managed tools but keeps the pin at 1.95.0.)
Reproduction
- macOS 27.2 (26B5091g), Xcode 27.0, arm64, at
block/buzzmain with the pinned toolchain:
$ cargo build --release -p buzz-db
error: …/libsqlx_macros-<hash>.dylib: dlopen(…): … mis-aligned LINKEDIT string pool, fileOffset=0x008730AC
error[E0432]: unresolved imports `self::encode::Encode`, …
error: could not compile `sqlx` (lib) due to 2 previous errors
cargo checkand tests pass, because the dev profile doesn't strip. Release builds ofbuzz-relayand anything else that depends onsqlxmacros fail the same way.
Root cause
- Cargo's release profile defaults to
strip = "debuginfo". On macOS,rustcstrips with its bundledrust-objcopy(LLVM), not Apple'sstrip. - LLVM's Mach-O objcopy wrote
__LINKEDITentries at offsets that are only 4-byte aligned, which macOS 27's dyld now rejects. - Upstream reports and fixes:
- rust-lang/rust#157750
- llvm/llvm-project#203678, fixed by llvm/llvm-project#203680
- picked up in rust-lang/rust#158410, milestone 1.98.0
Checked on the same sqlx-macros dylib:
| Step | Result on macOS 27.2 |
|---|---|
| Unstripped | loads |
Apple strip -S / strip -x |
loads |
LLVM objcopy --strip-debug (Rust 1.95 / 1.96 / 1.97.1) |
mis-aligned LINKEDIT string pool |
cargo build --release -p buzz-db on Rust 1.99.0 |
builds; dylib loads |
Small proc-macro dylibs often pass by luck of alignment, which is why a trivial repro may not trigger it. The sqlx-macros dylib Buzz builds (~12 MB, with Buzz's sqlx features) triggers it reliably.
Suggested fix
Bump rust-toolchain.toml to 1.98.0 or later (current stable is 1.99.0).
Until then, this workaround disables stripping only for build-time artifacts (proc macros, build scripts) and leaves shipped binaries unchanged:
CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_STRIP=none cargo build --release
or
[profile.release.build-override]
strip = "none"
- 主要言語
- Rust
- スター
- 35.3k
- フォーク
- 4.7k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 175
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
block/buzz のほかの issue
-
Mobile: opening an attachment names the file after the link text instead of the imeta filename対応中かも @wenhaoone が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Desktop: private project home channels show no lock icon in the sidebar対応中かも @Bartok9 が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
buzz-pair: panics on wss:// relays — rustls CryptoProvider never installed対応中かも @Bartok9 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
block/buzz#7880 · コメント 2 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
Devolutions/picky-rs#546 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zcashlabs/thus-spoke-zakura#153 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
topgrade-rs/topgrade#2395 ·
メンテナーはふだん 1 日以内に返信