1# Chapter 20: fixups, the answers reindeer cannot work out
2
3Cargo does a few things quietly that buck2 will not do unless told. The
4biggest is the *build script*: a `build.rs` file some crates ship, which
5cargo compiles and runs before the crate itself, to probe the compiler, find
6a system library or generate code. reindeer (chapter 19) can see that a
7crate has one, but not whether its output matters here, so it asks. Each
8folder here is the answer for one crate, in a `fixups.toml`.
9
10Most answers are one line. Some are not:
11
12```toml
13# fixups/alsa-sys/fixups.toml
14# alsa-sys links libasound at BUILD time (every other windowing/audio crate
15# here dlopens at run time). Its build script finds the library with
16# pkg-config and says so in cargo:rustc-link-lib / rustc-link-search, which
17# buck2's buildscript runner drops unless asked to keep them - leaving
18# snd_pcm_* undefined at the final link.
19[buildscript.run]
20rustc_link_lib = true
21rustc_link_search = true
22```
23
24> **Aside: the one that is not about a build script.** `fixups/subsecond/`
25> gives the hot-patching crate (chapter 27) its own `-Cdebug-assertions=yes`.
26> Under cargo, one profile setting covers the whole dependency graph; under
27> buck2 every third-party crate is its own compiler invocation, and
28> subsecond's patch machinery is a silent no-op unless *its own*
29> compilation has debug assertions on. Without this file a patch reports
30> "applied" and nothing changes.
31
32> **Try it.** `ls third-party/rust/fixups` lists every crate that needed
33> telling something (49 of them), and
34> `cat third-party/rust/fixups/subsecond/fixups.toml` is the one with the
35> longest story.
36
37## For the people who maintain it
38
39### In this folder
40
41| Path | What |
42| --- | --- |
43| `<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`. |
44| [README.md](README.md) | This chapter. reindeer looks fixups up by crate name only, so this file and CLAUDE.md are never read as one. |
45| [CLAUDE.md](CLAUDE.md) | How to answer a new crate, for agents. |
46
47The per-crate folders get no chapters of their own: they are one small
48config file each, sharded by crate name for reindeer, with no idea to teach
49beyond this page.
50
51← Previous: [Chapter 19, rust/](../) · Up: [rust](../) · Next: [Chapter 21, top/](../top/) →