Skip to content

feat: make clang20 preset use zig with glibc 2.35#20897

Merged
johnathan79717 merged 4 commits into
merge-train/barretenbergfrom
jh/clang20-zig-glibc235
Feb 26, 2026
Merged

feat: make clang20 preset use zig with glibc 2.35#20897
johnathan79717 merged 4 commits into
merge-train/barretenbergfrom
jh/clang20-zig-glibc235

Conversation

@johnathan79717

@johnathan79717 johnathan79717 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Change the `clang20` preset (and variants) to use `zig cc/c++ -target native-linux-gnu.2.35` instead of plain `clang-20`. This ensures every build — dev and release — produces binaries compatible with Ubuntu 22.04+ (glibc 2.35).
  • Pin cross-compile zig presets (`zig-amd64-linux`, `zig-arm64-linux`) to glibc 2.35.
  • The `native` zig target auto-detects host architecture — no hardcoded `x86_64`/`aarch64`.
  • `debug` preset inherits from `default` with explicit `CC=clang-20` so all sanitizer presets (ASAN/TSAN/UBSAN/MSAN) use plain clang-20. Zig does not provide the sanitizer runtimes (`libclang_rt.asan` etc.).
  • `smt-verification` inherits from `clang20` but overrides to `CC=clang-20` with `CMAKE_AR=null`, since cvc5's ExternalProject receives `CMAKE_C_COMPILER` and needs a plain binary path.
  • Remove `bb-cpp-cross-amd64-linux` Makefile target — native `clang20` build now covers amd64-linux.
  • Remove release-preset switching in `bootstrap.sh` — `clang20`'s `build/` dir is already glibc 2.35 compatible.

Test plan

  • Built `bb` with `cmake --preset clang20`, confirmed max glibc requirement is 2.34 via `readelf -V`
  • Ran `bb --version` inside `ubuntu:22.04` Docker container — succeeded
  • Fuzz presets configure/build correctly (fixed `[[maybe_unused]]` for `-Wunused-variable` under `-Wfatal-errors`)
  • `asan-fast` preset configures with `clang-20` compiler (not zig) — `CMAKE_C_COMPILER=/usr/bin/clang-20`
  • `smt-verification` preset configures with `clang-20` — `CMAKE_C_COMPILER=/usr/bin/clang-20`

Change the clang20 preset (and variants) to use zig cc/c++ with
native-linux-gnu.2.35 target. This ensures every build — dev and
release — produces binaries compatible with Ubuntu 22.04+ (glibc 2.35).

Also pin cross-compile zig presets (zig-amd64-linux, zig-arm64-linux)
to glibc 2.35.

Tested: bb built with cmake --preset clang20 runs correctly in
ubuntu:22.04 docker container. Max glibc required: 2.34.
@johnathan79717 johnathan79717 added the ci-full Run all master checks. label Feb 26, 2026
Three fixes:

1. smt-verification preset: override CC/CXX back to clang-20 and
   clear CMAKE_AR/CMAKE_RANLIB. cvc5's ExternalProject configure.sh
   passes CMAKE_C_COMPILER=/usr/local/bin/zig to cmake which then
   calls zig without the 'cc' subcommand, breaking compiler detection.
   SMT is a CI-only tool so glibc 2.35 targeting is not required.

2. field.fuzzer.hpp: mark uint_product [[maybe_unused]] — only used
   in assert() which is compiled away in some build configs.

3. sha256.fuzzer.cpp: mark circuit_val [[maybe_unused]] — same reason.
…resets

Zig does not provide the ASAN/TSAN/etc. runtime libraries (libclang_rt.asan),
causing link errors for __asan_* symbols. Debug and sanitizer presets now
override CC/CXX back to plain clang-20 (inheriting clang20's cmake settings
like TARGET_ARCH/ENABLE_PIC, but skipping zig's compiler wrapper).

smt-verification similarly uses clang-20 directly because cvc5's ExternalProject
receives CMAKE_C_COMPILER and needs a plain compiler binary (not zig, which
requires the `cc` subcommand).

Both presets null out CMAKE_AR/CMAKE_RANLIB so zig-ar.sh does not propagate
to sub-projects.
@johnathan79717 johnathan79717 enabled auto-merge (squash) February 26, 2026 16:55
…warnings

Zig does not provide libFuzzer (libclang_rt.fuzzer), causing 'undefined symbol: main'
when linking fuzzer binaries with -fsanitize=fuzzer. Change fuzzing presets to use
plain clang-20 instead of zig:
- fuzzing: inherits from default with CC=clang-20 (was clang20/zig)
- fuzzing-noasm, fuzzing-coverage: now inherit from fuzzing
- fuzzing-avm: override CC/CXX to clang-20, null CMAKE_AR/RANLIB

Also fix two more [[maybe_unused]] warnings in fuzzer files where variables are
only referenced inside assert() which is compiled away in release builds:
- field.fuzzer.hpp: product
- sha256.fuzzer.cpp: expected_output
@johnathan79717 johnathan79717 merged commit ca51e5c into merge-train/barretenberg Feb 26, 2026
10 checks passed
@johnathan79717 johnathan79717 deleted the jh/clang20-zig-glibc235 branch February 26, 2026 18:56
github-merge-queue Bot pushed a commit that referenced this pull request Feb 27, 2026
BEGIN_COMMIT_OVERRIDE
chore: builders audit response 0 (#20792)
feat: early circuit block deallocation after trace populate (#20776)
fix: Fix script for testing vks haven't changed (#20852)
fix: move debug_incoming_circuit before block deallocation in
Chonk::accumulate (#20876)
refactor: deduplicate debug_incoming_circuit in Chonk::accumulate
(#20870)
fix: denoise causing mysterious error 141 (#20871)
feat: make clang20 preset use zig with glibc 2.35 (#20897)
chore: remove final instances of unneeded +1 in SRS construction
(#20912)
chore: avoid use of size_t in bbapi to be safe (#20916)
chore: Claudebox remedy example (#20922)
END_COMMIT_OVERRIDE
johnathan79717 added a commit that referenced this pull request Mar 4, 2026
## Summary
- Change the \`clang20\` preset (and variants) to use \`zig cc/c++
-target native-linux-gnu.2.35\` instead of plain \`clang-20\`. This
ensures every build — dev and release — produces binaries compatible
with Ubuntu 22.04+ (glibc 2.35).
- Pin cross-compile zig presets (\`zig-amd64-linux\`,
\`zig-arm64-linux\`) to glibc 2.35.
- The \`native\` zig target auto-detects host architecture — no
hardcoded \`x86_64\`/\`aarch64\`.
- \`debug\` preset inherits from \`default\` with explicit
\`CC=clang-20\` so all sanitizer presets (ASAN/TSAN/UBSAN/MSAN) use
plain clang-20. Zig does not provide the sanitizer runtimes
(\`libclang_rt.asan\` etc.).
- \`smt-verification\` inherits from \`clang20\` but overrides to
\`CC=clang-20\` with \`CMAKE_AR=null\`, since cvc5's ExternalProject
receives \`CMAKE_C_COMPILER\` and needs a plain binary path.
- Remove \`bb-cpp-cross-amd64-linux\` Makefile target — native
\`clang20\` build now covers amd64-linux.
- Remove release-preset switching in \`bootstrap.sh\` — \`clang20\`'s
\`build/\` dir is already glibc 2.35 compatible.

## Test plan
- [x] Built \`bb\` with \`cmake --preset clang20\`, confirmed max glibc
requirement is 2.34 via \`readelf -V\`
- [x] Ran \`bb --version\` inside \`ubuntu:22.04\` Docker container —
succeeded
- [x] Fuzz presets configure/build correctly (fixed \`[[maybe_unused]]\`
for \`-Wunused-variable\` under \`-Wfatal-errors\`)
- [x] \`asan-fast\` preset configures with \`clang-20\` compiler (not
zig) — \`CMAKE_C_COMPILER=/usr/bin/clang-20\`
- [x] \`smt-verification\` preset configures with \`clang-20\` —
\`CMAKE_C_COMPILER=/usr/bin/clang-20\`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants