Update Docker builds and native DEB/RPM package builds to use Clang instead of GCC.#21802
Draft
Ferroin wants to merge 3 commits intonetdata:masterfrom
Draft
Update Docker builds and native DEB/RPM package builds to use Clang instead of GCC.#21802Ferroin wants to merge 3 commits intonetdata:masterfrom
Ferroin wants to merge 3 commits intonetdata:masterfrom
Conversation
Cuts the build time by anywhere from 30-50% on my laptop, CI jobs should see roughly similar gains for the actual build step.
Contributor
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant CI as CI Runner / Developer
participant Env as Build Environment (Docker/RPM/Shell)
participant Script as Build Script (CMake / Installer)
participant Clang as NEW: Clang / Clang++
participant GCC as Legacy: GCC
Note over CI,Clang: Build-Time Control Flow Changes
CI->>Env: Trigger Build (Docker, RPM, or Script)
alt RPM Package Build (.spec)
Env->>Env: NEW: BuildRequires clang
Env->>Env: NEW: %define __cc clang / %define __cxx clang++
Env->>Env: NEW: Set CFLAGS with Clang-specific noise suppression
else Native Shell Build (build-package.sh)
Env->>Env: NEW: export CC=clang
Env->>Env: NEW: export CXX=clang++
else Docker Image Build (Dockerfile)
Env->>Env: NEW: Inline CC=clang CXX=clang++ env vars
end
Env->>Script: Execute Build Command
alt "Happy Path": Optimized Toolchain
Script->>Clang: Invoke Compiler (via CC/CXX environment)
Clang->>Clang: Process source with optimized CFLAGS
Clang-->>Script: Compiled Binaries (8-50% faster build)
else "Unhappy Path": General Build Testing (Unchanged)
Note right of GCC: Retained for test coverage in specific jobs
Script->>GCC: Invoke Compiler (Default System CC)
GCC-->>Script: Compiled Binaries
end
Script-->>Env: Final Artifact (DEB/RPM/Docker Image)
Env-->>CI: Build Complete
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.
Summary
As described in the title, this updates our Docker builds and native DEB/RPM package builds to use Clang instead of GCC for C/C++ compilation. This, in turn, speeds up the build process by a meaningful amount, which improves CI job runtimes by a meaningful amount.
Local testing on my laptop saw the following actual improvements in average build times compared to commit e6cddfb from the master branch:
Test Plan
Requires verification that this doesn’t introduce performance regressions at runtime (I do not expect it to do so).
Additional Information
Similar changes for static-builds are in development and will be handled as a separate PR.
Assuming this is merged I will be opening a separate PR to remove the dedicated Clang CI job.
General build testing jobs have intentionally been left using GCC so that we have test coverage in CI for building with GCC. If we decide long-term to require Clang for our builds I can update those jobs as well.
Summary by cubic
Switch Docker and native DEB/RPM builds to Clang for C/C++ to speed up compilation and CI. Local tests show 8–50% faster builds (Fedora RPM ~8%, Debian DEB ~39%, Docker ~50%).
Written for commit 2674182. Summary will update on new commits.