Release builds fail on macOS 27: Rust 1.95 strips proc-macro dylibs with misaligned __LINKEDIT (fixed in Rust 1.98)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 80/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- macos, rust
- Domain
- build-system
Research direction
The fix is a one-line change to the channel in rust-toolchain.toml at the repo root, bumping the pin from 1.95.0 to 1.98.0 or later (1.99.0 is current stable). Verify with cargo build --release -p buzz-db on macOS 27, which previously failed with the mis-aligned LINKEDIT dlopen error; the sqlx-macros dylib loading is the signal that it worked. Check #8049 first, since it upgrades Hermit-managed tools while keeping the pin at 1.95.0 and may conflict.
Written by the indexing model from the issue text.
Description
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"
- Dominant language
- Rust
- Stars
- 35.3k
- Forks
- 4.7k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 176
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from block/buzz
-
Mobile: opening an attachment names the file after the link text instead of the imeta filenamePossibly taken @wenhaoone claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Desktop: private project home channels show no lock icon in the sidebarPossibly taken @Bartok9 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
buzz-pair: panics on wss:// relays — rustls CryptoProvider never installedPossibly taken @Bartok9 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
block/buzz#7880 · 2 comments · 2 reactions ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
security-scan
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
content good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
StudentSuite/awesome-skills-plugins-for-students#293 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
gfx-rs/wgpu-native#636 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day