Skip to content

fix: add -g0 to zig presets to eliminate 11GB debug info bloat (backport #21071)#21085

Merged
ludamad merged 1 commit intov4from
claudebox/df32ffacdebfa007-1
Mar 3, 2026
Merged

fix: add -g0 to zig presets to eliminate 11GB debug info bloat (backport #21071)#21085
ludamad merged 1 commit intov4from
claudebox/df32ffacdebfa007-1

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Mar 3, 2026

Summary

Backport of #21071 to v4.

Adds -g0 to zig cross-compilation presets to suppress DWARF debug info that inflates the build directory from 2.8 GB to 14.0 GB. Also unsets CFLAGS/CXXFLAGS for the lmdb external build to prevent -g0 from interfering.

Conflict resolution

The clang20 preset on v4 uses system clang-20 (not zig), so the -g0 addition to that preset was dropped — it only applies to zig's debug info behavior. The zig-base preset change (which all cross-compilation presets inherit) and the lmdb.cmake change applied cleanly.

ClaudeBox log: http://ci.aztec-labs.com/df32ffacdebfa007-1

Zig cc injects DWARF debug info into every object file by default, even
in Release (-O3) mode. This inflates the barretenberg build directory
from **2.8 GB to 14.0 GB** (5x blowup). Adding `-g0` to suppress this
brings zig builds in line with system clang builds.

| Artifact | Before (-g0) | After (-g0) | Reduction |
|----------|-------------|-------------|-----------|
| Total build dir | 14.0 GB | 2.8 GB | **80%** |
| libvm2.a | 1,406 MB | 219 MB | 84% |
| bb-avm | 1,271 MB | 182 MB | 86% |
| prover.cpp.o | 486 MB | 31 MB | 94% |

- Adds `"CFLAGS": "-g0", "CXXFLAGS": "-g0"` to the `clang20` preset
(native zig builds)
- Adds the same to the `zig-base` preset (all cross-compilation presets
inherit from this)
- Presets that intentionally use `-g` (tracy, debug, xray) override
these flags as expected

- Machine code output is identical (verified: .text sections are
byte-for-byte the same)
- Incremental builds are fully preserved
- Build time improves marginally (5m29s → 5m06s)

Full analysis:
https://gist.github.com/AztecBot/5c919316852d4d66095d0eefaa1a7c00

ClaudeBox log: http://ci.aztec-labs.com/1a779e17d1e4caac-2
@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 3, 2026
@ludamad ludamad added ci-release-pr ci-draft Run CI on draft PRs. labels Mar 3, 2026
@ludamad ludamad marked this pull request as ready for review March 3, 2026 23:51
@ludamad ludamad enabled auto-merge (squash) March 3, 2026 23:51
@ludamad ludamad disabled auto-merge March 3, 2026 23:51
@ludamad ludamad enabled auto-merge (squash) March 3, 2026 23:51
@ludamad ludamad disabled auto-merge March 3, 2026 23:51
@ludamad ludamad merged commit da8f7b8 into v4 Mar 3, 2026
38 of 39 checks passed
@ludamad ludamad deleted the claudebox/df32ffacdebfa007-1 branch March 3, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants