Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
Ferroin:clang-builds-1
Draft

Update Docker builds and native DEB/RPM package builds to use Clang instead of GCC.#21802
Ferroin wants to merge 3 commits intonetdata:masterfrom
Ferroin:clang-builds-1

Conversation

@Ferroin
Copy link
Member

@Ferroin Ferroin commented Feb 23, 2026

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:

  • Fedora 43 x86-64 RPM builds: ~8%
  • Debian 13 x86-64 DEB builds: ~39%
  • Docker x86-64 builds: ~50%
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%).

  • Refactors
    • Default to Clang/Clang++ in Dockerfile and build-package.sh via CC/CXX.
    • RPM spec: replace gcc/gcc-c++ with clang; set __cc/__cxx and add safe CFLAGS.

Written for commit 2674182. Summary will update on new commits.

Cuts the build time by anywhere from 30-50% on my laptop, CI jobs should
see roughly similar gains for the actual build step.
@github-actions github-actions bot added the area/packaging Packaging and operating systems support label Feb 23, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/packaging Packaging and operating systems support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant