Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Release builds fail on macOS 27: Rust 1.95 strips proc-macro dylibs with misaligned __LINKEDIT (fixed in Rust 1.98)

オープン 初心者向け
#8,074 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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/buzz main 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 check and tests pass, because the dev profile doesn't strip. Release builds of buzz-relay and anything else that depends on sqlx macros fail the same way.

Root cause

  • Cargo's release profile defaults to strip = "debuginfo". On macOS, rustc strips with its bundled rust-objcopy (LLVM), not Apple's strip.
  • LLVM's Mach-O objcopy wrote __LINKEDIT entries 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

block/buzz のほかの issue

block/buzz の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。