Build fails on macOS 27: dyld refuses stripped Rust proc-macros (mis-aligned LINKEDIT string pool)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 73/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- macos, rust
- Domain
- build-system
Research direction
Start with the Rust version pin in build/deps/rust.MODULE.bazel and the macOS build settings in .bazelrc; compare the proposed 1.98.0 upgrade with the temporary exec rustc flag workaround. Check that the selected fix allows bazel build //src/workerd/server:workerd to complete on macOS 27 while preserving the --config=cross-lto toolchain requirement.
Written by the indexing model from the issue text.
Description
On macOS 27, bazel build //src/workerd/server:workerd on main (e7d43bddb) fails at the first crate that uses a proc-macro:
error[E0463]: can't find crate for `thiserror_impl`
rustc can't load the proc-macro dylib, and dlopen on it says why:
dlopen(.../darwin_arm64-opt-exec/bin/external/rules_rust++i2+rrc__thiserror-impl-1.0.69/libthiserror_impl-991351018.dylib, 0x0002): tried: '...' (mis-aligned LINKEDIT string pool, fileOffset=0x001682DC)
This is rust-lang/rust#157750. Bazel builds exec-config Rust in opt mode, where rules_rust passes -Cstrip=debuginfo. The LLVM in rustc 1.97 writes the stripped dylib's string pool at a 4-byte boundary (LC_SYMTAB stroff 1475292), and dyld rejects that when the dylib was linked against the 27 SDK. llvm/llvm-project#203680 fixed the stripper, and rustc 1.98.0 shipped it (rust-lang/rust#158410). workerd pins 1.97.1 in build/deps/rust.MODULE.bazel.
I hit it on macOS 27.3 (26C5047e) with the Command Line Tools linker (ld-27106.1, SDK 27.2). CI runs macos-26-xlarge, and the README tests Xcode 26.6, so neither should see it; I haven't checked an Xcode 26 build on a macOS 27 host.
The workaround is one line in .local/bazelrc:
build --@rules_rust//:extra_exec_rustc_flag=-Cstrip=none
With it, the same build on a clean main worktree completes in 2990 s.
I see two fixes:
- Bump
RUST_STABLE_VERSIONto 1.98.0. It's the last stable on LLVM 22, so it still matches the toolchains_llvm 22.1.8 that--config=cross-ltoneeds; 1.99 moves to LLVM 23. rules_rust 0.75.0 already has its checksums. - Put the flag above under
build:macosin.bazelrcuntil the bump lands.
I have an attempt at (2) on a branch if you want it.
Minimal cdylib from rust-lang/rust#157750 on 3 rustc versions: only 1.97.1 with strip=debuginfo fails to load
minimal.rs is the MCVE from the rustc issue, built with rustc --crate-type cdylib minimal.rs -C strip=<level> and loaded with a 5-line dlopen program, on macOS 27.3.
| rustc (LLVM) | strip | stroff mod 8 |
dlopen |
|---|---|---|---|
| 1.97.1 (22.1.6) | debuginfo | 4 | mis-aligned LINKEDIT string pool |
| 1.97.1 (22.1.6) | none | 0 | ok |
| 1.98.0 (22.1.8) | debuginfo | 0 | ok |
| 1.98.0 (22.1.8) | none | 0 | ok |
| 1.100.0 (23.1.5) | debuginfo | 0 | ok |
| 1.100.0 (23.1.5) | none | 0 | ok |
- Dominant language
- C++
- Stars
- 9.3k
- Forks
- 845
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 558
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No 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 cloudflare/workerd
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/workerd#8807 ·
Maintainers usually reply within 1 day
-
D1 export: `quote()` in d1.js turns a literal `\n` into a newline when the value also has a real newlinePossibly taken @Jeremiah-D claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
cloudflare/workerd#8678 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/workerd#8575 ·
Maintainers usually reply within 1 day
-
fix(types): ForwardableEmailMessage omits the documented canBeForwarded propertyPossibly taken @itsrayeedscodespace claimed this 18 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/workerd#8290 ·
Maintainers usually reply within 1 day
-
Streaming TextDecoder drops U+FEFF at the start of a chunk that follows an ASCII-only chunkMay be free again @oliarmak-web claimed this 19 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/workerd#8279 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cloudflare/workerd
Similar issues
-
Android Bug Core Drape
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
organicmaps/organicmaps#14449 ·
Maintainers usually reply within 1 day
-
comp-codecs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ClickHouse/ClickHouse#135159 ·
Maintainers usually reply within 1 day
-
difficulty:easy func:python os:windows prio:high type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NatronGitHub/Natron#2029 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
ardazishvili/Sota#114 ·
Maintainers usually reply within 1 day
-
`Rect::containsPoint` is not `const`, so a `const Rect` cannot be asked whether it holds a pointOpenNeeds: Triage :mag:
Difficulty 1/5 Under an hour Newbie friendliness 82/100
react/react-native#60349 ·
Maintainers usually reply within 1 day