Chapter 20: fixups, the answers reindeer cannot work out
Cargo does a few things quietly that buck2 will not do unless told. The
biggest is the build script: a build.rs file some crates ship, which
cargo compiles and runs before the crate itself, to probe the compiler, find
a system library or generate code. reindeer (chapter 19) can see that a
crate has one, but not whether its output matters here, so it asks. Each
folder here is the answer for one crate, in a fixups.toml.
Most answers are one line. Some are not:
# fixups/alsa-sys/fixups.toml
# alsa-sys links libasound at BUILD time (every other windowing/audio crate
# here dlopens at run time). Its build script finds the library with
# pkg-config and says so in cargo:rustc-link-lib / rustc-link-search, which
# buck2's buildscript runner drops unless asked to keep them - leaving
# snd_pcm_* undefined at the final link.
[buildscript.run]
rustc_link_lib = true
rustc_link_search = true
Aside: the one that is not about a build script.
fixups/subsecond/gives the hot-patching crate (chapter 27) its own-Cdebug-assertions=yes. Under cargo, one profile setting covers the whole dependency graph; under buck2 every third-party crate is its own compiler invocation, and subsecond's patch machinery is a silent no-op unless its own compilation has debug assertions on. Without this file a patch reports "applied" and nothing changes.
Try it.
ls third-party/rust/fixupslists every crate that needed telling something (49 of them), andcat third-party/rust/fixups/subsecond/fixups.tomlis the one with the longest story.
For the people who maintain it
In this folder
| Path | What |
|---|---|
<crate>/fixups.toml | One folder per crate, named exactly as the crate (reindeer looks them up by name): buildscript.run = true/false, link directives to keep, extra rustc_flags. |
| README.md | This chapter. reindeer looks fixups up by crate name only, so this file and CLAUDE.md are never read as one. |
| CLAUDE.md | How to answer a new crate, for agents. |
The per-crate folders get no chapters of their own: they are one small config file each, sharded by crate name for reindeer, with no idea to teach beyond this page.
← Previous: Chapter 19, rust/ · Up: rust · Next: Chapter 21, top/ →