Release builds fail on macOS 27: Rust 1.95 strips proc-macro dylibs with misaligned __LINKEDIT (fixed in Rust 1.98)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 80/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- macos, rust
- Ambito
- build-system
Direzione di ricerca
La correzione è una modifica di una riga al channel in rust-toolchain.toml nella root del repo, che sposta il pin da 1.95.0 a 1.98.0 o successivo (1.99.0 è la versione stabile attuale). Verifica con cargo build --release -p buzz-db su macOS 27, che in precedenza falliva con l'errore mis-aligned LINKEDIT dlopen; il caricamento di sqlx-macros dylib è il segnale che ha funzionato. Controlla prima #8049, poiché aggiorna gli strumenti gestiti da Hermit mantenendo il pin a 1.95.0 e potrebbe entrare in conflitto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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"
- Lingua principale
- Rust
- Stelle
- 35.6k
- Fork
- 4.7k
- Merge medio
- 2g 4h
- PR unite (30g)
- 202
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di block/buzz
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Mobile: opening an attachment names the file after the link text instead of the imeta filenameForse già presa @wenhaoone l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Desktop: private project home channels show no lock icon in the sidebarForse già presa @Bartok9 l’ha presa 7 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Desktop crashes on launch: undefined is not an object (evaluating 'e.participantPubkeys.map')Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
status:needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agentic-os-org/ANOLISA#6742 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
git-ai-project/git-ai#2406 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
Kc1t/alethe-agents#312 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno