Skip to content

Allow cross-compiling Linux binaries on a macOS host - #131330

Merged
Algunenano merged 2 commits into
ClickHouse:masterfrom
Algunenano:darwin-host-linux-cross-build
Nov 13, 2026
Merged

Algunenano merged 2 commits into
ClickHouse:masterfrom
Algunenano:darwin-host-linux-cross-build

Conversation

@Algunenano

@Algunenano Algunenano commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Configuring a Linux build on a macOS host failed in cmake/cpu_features.cmake: the build-host CPU checks run whenever the target is Linux and read the host's /proc/cpuinfo, which does not exist on macOS. The checks are about build-time tools running on the host, so they now run only on Linux hosts.

With that, a Linux ARM64 binary cross-compiled on a Mac runs integration tests through the Apple container setup in tests/integration/README.md. The README now documents the cross build and the Homebrew packages. The local runner also failed without the requests module because ci/praktika/cidb.py decided whether it is a local run at import time, before that was known; requests is now imported where it is used.

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Allow cross-compiling Linux binaries on a macOS host.


Workflow [PR]
Sync PR [sync-upstream/pr/131330]

Version info

  • Merged into: 26.11.1.2244-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bdb88da]

Summary: ❌

job_name test_name status info comment
Finish Workflow FAIL
python3 ./ci/jobs/scripts/workflow_hooks/can_be_merged.py --review-threads FAIL

AI Review

Summary

PR #131330 restricts host CPU probes to Linux hosts, defers importing requests until CI database HTTP operations, and documents Linux ARM64 cross-compilation on macOS. Reviewed head bdb88da6c123fff1ae720bedec9a2057a07ee9cd, the full diff, surrounding code, and all prior discussion. No actionable blockers or major findings.

Missing context / blind spots
  • ⚠️ End-to-end macOS cross-compilation and Apple container execution could not be repeated on this Linux host. The author reports successful manual validation; running the documented commands on Apple silicon would close this platform coverage gap. Focused import and simulated-host CMake checks passed, including controls reproducing the original failures.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-build Pull request with build/testing/packaging improvement label Nov 13, 2026
@clickhouse-gh
clickhouse-gh Bot requested review from leshikus and maxknv November 13, 2026 14:51
@clickhouse-gh clickhouse-gh Bot added the comp-build-system Build system (CMake, compilation, platform builds). label Nov 13, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing bdb88da6c with master 544355ca1 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse ×0.66, programs/clickhouse-keeper ×0.70 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse DB::registerFunctionConversion(DB::FunctionFactory&) 5.7 s 13.2 s +9.4 s (+250%)
programs/clickhouse _ZN6detail10static_forITk7is_enumN2DB23AttributeUnderlyingTypeEZNS1_29callOnDictionaryAttributeType… 3.3 s 7.6 s +5.4 s (+251%)
Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

@leshikus leshikus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good

Comment thread ci/praktika/cidb.py Resolved
@Algunenano
Algunenano enabled auto-merge November 13, 2026 18:24
@Algunenano
Algunenano added this pull request to the merge queue Nov 13, 2026
Merged via the queue into ClickHouse:master with commit 88d8610 Nov 13, 2026
204 of 206 checks passed
@Algunenano
Algunenano deleted the darwin-host-linux-cross-build branch November 13, 2026 20:59
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-build-system Build system (CMake, compilation, platform builds). pr-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants