Repository navigation
Build the toolchain with zlib so clang supports -gz - #109596
Merged
Merged
Conversation
… sections) The bundled LLVM toolchain is built LLVM_ENABLE_ZLIB=OFF, so its clang rejects -gz=zlib. Enable zlib for the stage-2 (shipped) clang and add zlib1g-dev to the binary-builder image so LLVM finds it. This lets COMPRESS_DEBUG_SECTIONS (root CMakeLists) auto-detect support and compress object-file debug sections in CI and standard dev builds, not only with a zlib-enabled system clang. Stage 1 (instrumented, profile-generation only) is left without zlib. Co-Authored-By: Claude <[email protected]>
Contributor
|
Workflow [PR], commit [b033f8b] Summary: ✅
AI ReviewSummaryThis PR updates the Findings
Final Verdict
|
LLVM_ENABLE_ZLIB=ON is best-effort - if zlib is not found it silently disables and the build still succeeds, producing a clang without -gz support. FORCE_ON errors at configure instead, so we cannot publish a toolchain that claims -gz support it does not have. Co-Authored-By: Claude <[email protected]>
murphy-4o
marked this pull request as ready for review
July 7, 2026 04:57
murphy-4o
marked this pull request as draft
July 7, 2026 07:11
LLVM installs the versioned clang-21 and the unversioned clang++ (-> clang -> clang-21), but no versioned clang++-21. Since ClickHouse selects compilers by versioned name, CMake finds this toolchain's clang-21 for C/ASM but falls through PATH to a different clang++-21 (e.g. the distro's) for C++ - a silent mismatch (it caused tidy builds to pair a zlib-less clang with a zlib-enabled clang++). Symlink clang++-21 -> clang before packaging so both resolve here. Co-Authored-By: Claude <[email protected]>
murphy-4o
commented
Jul 7, 2026
murphy-4o
marked this pull request as ready for review
July 7, 2026 11:41
azat
approved these changes
Jul 7, 2026
Reviewer nit (azat): use the shorter name, matching clangpp_inst above. Co-Authored-By: Claude <[email protected]>
build_toolchain.py now needs zlib1g-dev from ci/docker/binary-builder, but the Build Toolchain job's cache digest hashed only build_toolchain.py, so a Dockerfile-only change could skip the one job that validates the toolchain still configures in its real container. Add the image dir to include_paths (same pattern other jobs use for their docker dirs) so image changes re-run it. Co-Authored-By: Claude <[email protected]>
Adopt azat's review suggestion. Stage 1 is the instrumented clang used to build ClickHouse for PGO profile collection. With zlib on it, that build emits -gz=zlib (COMPRESS_DEBUG_SECTIONS auto-enables now that the compiler supports it), so the profile covers the debug-compression paths and stage 2 is tuned for them. FORCE_ON to match stage 2 and fail closed; zlib1g-dev is in the binary-builder image. Also corrects the profile-merge comment (stage 1 no longer lacks zlib). Co-Authored-By: Claude <[email protected]>
The option name plus FORCE_ON is self-explanatory; the rationale lives in the commit history and PR description. Co-Authored-By: Claude <[email protected]>
Out of scope for this PR - a CI cache-digest hygiene point the bot raised, not part of the zlib/-gz change. The review thread is resolved; keep the PR focused. Co-Authored-By: Claude <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…zlib Build the toolchain with zlib so clang supports -gz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bundled LLVM toolchain is built with
LLVM_ENABLE_ZLIB=OFF, so its clang can't do-gz=zlib. Enable zlib (FORCE_ON) for the stage-2 (shipped) clang and addzlib1g-devto thebinary-builderimage, so #109306'sCOMPRESS_DEBUG_SECTIONSauto-detects support and compresses object-file debug sections in CI and default builds (objects ≈ −50%, build dir ≈ −26%; binaries left uncompressed, so symbolization is unaffected).Also fixes a compiler-mismatch bug that #109306 surfaced. LLVM installs the versioned
clang-21plus unversionedclang++→clang→clang-21, but no versionedclang++-21. Since ClickHouse selects compilers by versioned name, CMake finds this toolchain'sclang-21for C/ASM but falls throughPATHto a differentclang++-21(the distro's) for C++ — so C and C++ are compiled by two different clang installs. It's normally invisible (both reportClang 21.1.8; only the resolved paths/usr/local/bin/clang-21vs/usr/bin/clang++-21differ), and-gzonly exposed it because one of the pair had zlib and the other didn't. Symlinkclang++-21→clangbefore packaging so C and C++ resolve to the same toolchain.Stage 1 (the instrumented clang used for PGO profile collection) is also built with zlib, so the profile-collection build compiles with
-gzand the resulting PGO profile covers those code paths.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Built the bundled LLVM toolchain with zlib so the shipped clang accepts
-gz=zlib(compressed DWARF debug sections), and added the missingclang++-21symlink so the toolchain's C and C++ compilers are the same install.Version info
26.7.1.644(included in26.7and later)