Skip to content

Fix cross compiling on Apple - #2882

Merged
mkmkme merged 7 commits into
antalya-26.8from
bugfix/antalya-26.8/fix_cross_compiling
Nov 19, 2026
Merged

mkmkme merged 7 commits into
antalya-26.8from
bugfix/antalya-26.8/fix_cross_compiling

Conversation

@ianton-ru

Copy link
Copy Markdown

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Fix cross compiling on Apple

Documentation entry for user-facing changes

Allow to compile Linux binary on Apple hosts.

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

@ianton-ru
ianton-ru marked this pull request as ready for review November 17, 2026 10:40
@ianton-ru ianton-ru added antalya port-antalya PRs to be ported to all new Antalya releases antalya-26.8 labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [6f9f2b7]

@mkmkme mkmkme 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.

🤖 [Posted by an LLM agent on behalf of @mkmkme]

Both changes look right for a macOS → Linux cross build and don't affect Linux hosts. Two suggestions inline: backport the upstream fix for cpu_features.cmake so the x86 check is covered too, and correct the root cause in the tblgen comment.

Comment thread cmake/cpu_features.cmake
if (OS_LINUX AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)" AND NOT NO_ARMV81_OR_HIGHER)
# `OS_LINUX` follows the target system, so a Darwin host cross-compiling for Linux matches it too. `/proc/cpuinfo` exists only on a
# Linux host, and host tools in that cross build are compiled for the Mac rather than with the target `-march`.
if (OS_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)" AND NOT NO_ARMV81_OR_HIGHER)

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.

🤖 [Posted by an LLM agent on behalf of @mkmkme]

Upstream fixed the same thing in ClickHouse#131330 (merge 88d8610fdb13). It also adds CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" to the x86 check in the ARCH_AMD64 branch, which still greps /proc/cpuinfo here, so an Intel Mac building an amd64 Linux target would still fail at configure. How about backporting it with git cherry-pick --no-commit -m1 88d8610fdb13 instead? That covers both checks and keeps us in sync with upstream.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

 Yeah, it's definitely better.

endif()

if (APPLE)
# Homebrew libc++ does not include <sys/resource.h>, which declares

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.

🤖 [Posted by an LLM agent on behalf of @mkmkme]

The cause isn't Homebrew libc++. llvm/llvm-project#142733 removed an include that brought in PRIO_DARWIN_THREAD/PRIO_DARWIN_BG indirectly, and llvm/llvm-project#208065 fixed it by including <sys/resource.h> in CrashRecoveryContext.cpp. Our LLVM submodule predates that fix; upstream's LLVM 23 bump has it. Could the comment reference llvm#208065 so the workaround can be dropped on the next LLVM bump? Optionally, the -include could also be limited to CrashRecoveryContext.cpp via set_source_files_properties rather than applied to every C++ file.

@ianton-ru

Copy link
Copy Markdown
Author

Add partial backport of ClickHouse#131330, add include in CrashRecoveryContext.cpp only.

@ianton-ru ianton-ru removed the port-antalya PRs to be ported to all new Antalya releases label Nov 17, 2026
@ianton-ru

Copy link
Copy Markdown
Author

Do not need to port in later versions. Partially backport, partially fixed in newer LLVM version.

@mkmkme
mkmkme merged commit b3cfe71 into antalya-26.8 Nov 19, 2026
301 of 309 checks passed
@ianton-ru ianton-ru added the verified Approved for release label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants