Build fails on macOS 27: dyld refuses stripped Rust proc-macros (mis-aligned LINKEDIT string pool)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 73/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- macos, rust
- 领域
- build-system
调研方向
从 build/deps/rust.MODULE.bazel 中固定的 Rust 版本和 .bazelrc 中的 macOS 构建设置入手;比较提议升级到 1.98.0 与临时使用 exec rustc 标志的变通方案。检查所选修复能否在 macOS 27 上完成 bazel build //src/workerd/server:workerd,同时保留 toolchain 要求 --config=cross-lto。
由索引模型根据 Issue 内容生成。
描述
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 |
- 主要语言
- C++
- 星标
- 9.3k
- 派生
- 845
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 558
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudflare/workerd 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/workerd#8807 ·
维护者通常 1 天内回复
-
D1 export: `quote()` in d1.js turns a literal `\n` into a newline when the value also has a real newline可能已有人在做 @Jeremiah-D 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
cloudflare/workerd#8678 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
cloudflare/workerd#8575 ·
维护者通常 1 天内回复
-
fix(types): ForwardableEmailMessage omits the documented canBeForwarded property可能已有人在做 @itsrayeedscodespace 于 18 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
cloudflare/workerd#8290 ·
维护者通常 1 天内回复
-
Streaming TextDecoder drops U+FEFF at the start of a chunk that follows an ASCII-only chunk可能重新可做 @oliarmak-web 于 19 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
cloudflare/workerd#8279 · 1 条评论 ·
维护者通常 1 天内回复
查看 cloudflare/workerd 的全部 Issue
相似的 Issue
-
Android Bug Core Drape
难度 2/5 1-3 小时 新手友好度 77/100
organicmaps/organicmaps#14449 ·
维护者通常 1 天内回复
-
comp-codecs
难度 2/5 1-3 小时 新手友好度 84/100
ClickHouse/ClickHouse#135159 ·
维护者通常 1 天内回复
-
difficulty:easy func:python os:windows prio:high type:bug
难度 2/5 1-3 小时 新手友好度 78/100
NatronGitHub/Natron#2029 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
ardazishvili/Sota#114 ·
维护者通常 1 天内回复
-
`Rect::containsPoint` is not `const`, so a `const Rect` cannot be asked whether it holds a point未关闭Needs: Triage :mag:
难度 1/5 1 小时以内 新手友好度 82/100
react/react-native#60349 ·
维护者通常 1 天内回复