Skip to content

feat: cross-compile & upgrade LLVM to 21.1.8 - #390

Merged
16bit-ykiko merged 52 commits into
mainfrom
feature/cross-compile
Apr 18, 2026
Merged

feat: cross-compile & upgrade LLVM to 21.1.8#390
16bit-ykiko merged 52 commits into
mainfrom
feature/cross-compile

Conversation

@16bit-ykiko

@16bit-ykiko 16bit-ykiko commented Apr 4, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds cross-compilation support for three new target platforms, upgrades LLVM to 21.1.8, and overhauls the CI pipelines around cross-builds and testing.

Cross-compilation

New target triples accepted via -DCLICE_TARGET_TRIPLE=...:

Target triple Host Output
x86_64-apple-darwin macos-15 (arm64) macOS x64
aarch64-linux-gnu ubuntu-24.04 (x64) Linux arm64
aarch64-pc-windows-msvc windows-2025 (x64) Windows arm64
  • cmake/toolchain.cmake — maps CLICE_TARGET_TRIPLE to CMAKE_SYSTEM_NAME/CMAKE_SYSTEM_PROCESSOR/compiler --target; picks up conda aarch64 sysroot when cross-compiling Linux.
  • cmake/llvm.cmake — forwards target platform/arch to setup-llvm.py so the right prebuilt LLVM is downloaded for the target.
  • CMakeLists.txt — uses a host-side flatc from PATH under CMAKE_CROSSCOMPILING instead of the in-tree target build.
  • pixi.toml:
    • Adds osx-64, linux-aarch64, win-arm64 platforms.
    • New environments: cross-macos-x64, cross-linux-aarch64 (adds gcc_linux-aarch64 + sysroot_linux-aarch64), cross-windows-arm64.
    • New lightweight test-run env used on native ARM/x64 runners to execute cross-built artifacts (pulls in upstream clang+lld on macOS so tests don't fall back to Apple clang).
  • scripts/activate_cross_linux.sh — exports CONDA_PREFIX-relative paths for the aarch64 toolchain.
  • scripts/build-llvm.py--target-triple support and a build_native_tools() helper that produces host llvm-tblgen / clang-tblgen needed when cross-compiling LLVM itself.

LLVM upgrade 21.1.4 → 21.1.8

  • cmake/package.cmake bumps setup_llvm("21.1.8").
  • config/llvm-manifest.json regenerated with 6 new cross-compiled entries and a new arch field on every entry so lookup is (version, platform, arch, lto, build_type).
  • scripts/setup-llvm.py — honours the new arch field when resolving artifacts.
  • scripts/update-llvm-version.py (new) — single-call version bump across package.cmake + manifest.
  • scripts/validate-llvm-components.py (new) — scans the LLVM source tree for library targets and diffs them against scripts/llvm-components.json to catch stale/misspelled component names before a build.
  • scripts/llvm-components.json (new) — explicit allow-list of required LLVM/Clang library targets used by build-llvm.py.

CI changes

  • .github/workflows/build-llvm.yml:
    • Adds workflow_dispatch with llvm_version, skip_upload, skip_pr inputs.
    • Matrix extended with the 6 cross-compile entries (2 per new platform: RelWithDebInfo ± LTO).
    • build clice / test / prune steps gated on !matrix.target_triple for cross-builds; cross-built LTO entries apply the native prune manifest (arch-independent).
    • Cross-compiled binary architecture is verified with file(1).
    • New upload job triggered by workflow_dispatch pushes artifacts to clice-io/clice-llvm and hands the manifest off to the next job.
  • .github/workflows/test-cmake.yml:
    • Build matrix gains three build_only: true cross entries that upload bin/ + lib/ artifacts.
    • New test-cross job runs on native macos-15-intel, ubuntu-24.04-arm, windows-11-arm runners, downloads the cross-built artifacts, and runs unit / integration / smoke tests under the test-run pixi env.
    • Cache keys now include target_triple so native and cross builds don't collide.
  • .github/workflows/publish-clice.yml:
    • Three additional release artifacts for the new targets (clice-x86_64-macos-darwin, clice-aarch64-linux-gnu, clice-aarch64-windows-msvc), each with a matching -symbol archive.

Compatibility

  • All existing native builds and tests are preserved; cross entries are additive.
  • Debug + ASAN remains disabled on Windows (llvm_mode == Debug && os == windows-* no longer appends -asan).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds cross-compilation support across CI and build tooling: new target triples in GitHub Actions, propagation of CLICE_TARGET_TRIPLE through scripts/CMake/toolchain, conditional CI steps for native vs cross builds, LLVM version bumped, and packaging/prune logic adjusted for cross targets.

Changes

Cohort / File(s) Summary
CI Workflows
\.github/workflows/build-llvm.yml, \.github/workflows/publish-clice.yml
Add workflow_dispatch; add cross-compilation matrix entries with target_triple; gate native-only vs cross steps; unify build to CMake/Ninja; change artifact naming/paths and prune/apply scoping; compute archive extension from matrix.asset_name.
CMake: LLVM & Package
cmake/llvm.cmake, cmake/package.cmake
setup_llvm now accepts optional --target-platform when CLICE_TARGET_TRIPLE set; bumped LLVM setup version llvmorg-21.1.4llvmorg-21.1.8.
CMake: Toolchain
cmake/toolchain.cmake
Add CLICE_TARGET_TRIPLE-driven cross-compilation config for x86_64-apple-darwin, aarch64-*-linux, aarch64-*-windows: sets CMAKE_SYSTEM_NAME/processor, compiler target, and sysroot handling.
Build Scripts
scripts/build-llvm.py, scripts/setup-llvm.py
Add CLI flags --target-triple (propagated to CMake as -DCLICE_TARGET_TRIPLE) and --target-platform (override artifact/platform selection); build script stops forcing -DLLVM_USE_LINKER=lld.
Config & Dependencies
config/llvm-manifest.json, pixi.toml
Clear llvm-manifest.json to []; add cross environments in pixi.toml including cross-linux-aarch64 with sysroot and cross gcc/g++ deps; two cross env placeholders added for macOS/Windows.
Packaging/Artifacts
\.github/workflows/publish-clice.yml (asset naming)
Replace artifact_name/symbol_artifact_name with asset_name/symbol_asset_name; update upload paths to build/release/... and symbol naming to clice-symbol....

Sequence Diagram

sequenceDiagram
    participant User
    participant CI as CI Runner
    participant CMake
    participant Toolchain as cmake/toolchain.cmake
    participant SetupLLVM as setup-llvm.py
    participant Builder as Build (cmake/ninja)

    User->>CI: trigger workflow (matrix may set target_triple)
    CI->>CMake: run cmake -B build/release ... (-DCLICE_TARGET_TRIPLE=TRIPLE)?
    CMake->>Toolchain: read CLICE_TARGET_TRIPLE
    Toolchain->>Toolchain: configure system name / processor / compiler target / sysroot
    CMake->>SetupLLVM: setup_llvm(... --target-platform=PLATFORM?)
    SetupLLVM->>SetupLLVM: select artifact manifest for PLATFORM
    CMake->>Builder: cmake --build build/release
    Builder->>CI: produce build artifact
    CI->>CI: run native or cross prune/apply/upload steps (gated by matrix)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • star-hengxing

Poem

🐰 Hopping through runners, I cheer and twirl,
Triples stacked like ribbons, flags unfurl,
macOS, Linux, Windows in a line,
LLVM bumped — the build logs shine,
A rabbit packs artifacts, ready to whirl.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: adding cross-compilation support and upgrading LLVM to version 21.1.8, matching the core objectives of the PR.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/cross-compile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/build-llvm.yml (1)

171-216: ⚠️ Potential issue | 🟠 Major

Make the prune manifest producer a separate job.

The +LTO legs download llvm-pruned-libs-${{ matrix.os }} from the same github.run_id, but sibling matrix legs have no ordering guarantee. If a consumer leg reaches apply before the native RelWithDebInfo/OFF leg uploads its artifact, this becomes a flaky CI failure.

🧹 Nitpick comments (3)
config/llvm-manifest.json (1)

1-1: Empty manifest will block builds until regenerated.

The manifest is intentionally cleared for the LLVM 21.1.8 upgrade. However, until build-llvm.yml and upload-llvm.yml are run to regenerate artifacts, any build that doesn't have a pre-existing LLVM install will fail in pick_artifact() with "No matching LLVM artifact in manifest".

Ensure the follow-up actions (run build-llvm.ymlupload-llvm.yml) are executed promptly after merging to restore build functionality.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/llvm-manifest.json` at line 1, The LLVM manifest file was cleared for
the 21.1.8 upgrade which leaves pick_artifact() unable to find artifacts and
will block builds; after merging, immediately run the build workflow
(build-llvm.yml) to produce artifacts and then run the upload workflow
(upload-llvm.yml) to update config/llvm-manifest.json so pick_artifact() can
locate matches; verify the manifest is populated and that pick_artifact()
succeeds in CI before closing the change.
.github/workflows/build-llvm.yml (2)

226-235: Fail fast on unsupported target triples.

Right now a typo or future triple addition leaves ARCH/PLATFORM/TOOLCHAIN unset and still produces a malformed artifact name.

Suggested hardening
           if [[ -n "${{ matrix.target_triple }}" ]]; then
             case "${{ matrix.target_triple }}" in
               x86_64-apple-darwin)
                 ARCH="x64"; PLATFORM="macos"; TOOLCHAIN="clang" ;;
               aarch64-linux-gnu)
                 ARCH="aarch64"; PLATFORM="linux"; TOOLCHAIN="gnu" ;;
               aarch64-pc-windows-msvc)
                 ARCH="aarch64"; PLATFORM="windows"; TOOLCHAIN="msvc" ;;
+              *)
+                echo "Unsupported target triple: ${{ matrix.target_triple }}" >&2
+                exit 1 ;;
             esac
           else
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build-llvm.yml around lines 226 - 235, The case block that
sets ARCH/PLATFORM/TOOLCHAIN for matrix.target_triple can leave those variables
unset for typos or unknown triples; add a default/fallback case in the case
statement (for the block handling "${{ matrix.target_triple }}") that logs an
explicit error mentioning the unrecognized target triple and exits non‑zero, and
also after the case ensure a guard that checks ARCH/PLATFORM/TOOLCHAIN are set
(e.g., test -n "$ARCH" && ...) to fail fast; update references to
ARCH/PLATFORM/TOOLCHAIN in the surrounding script to rely on this explicit
failure rather than producing malformed artifact names.

198-216: Please validate cross-target pruning before packaging.

These legs apply a manifest learned from the native arch and then upload immediately, but they never build a cross-target consumer against the pruned install. If the required LLVM library closure differs by target triple, this workflow can publish a broken archive without noticing. A per-target manifest or a small post-prune link smoke test would make this much safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build-llvm.yml around lines 198 - 216, The workflow
applies a native ARCH manifest using the step named "Apply pruned-libs manifest
(cross-compile + LTO)" (which calls scripts/prune-llvm-bin.py with
MANIFEST="pruned-libs-${{ matrix.os }}.json") but never verifies the pruned
install for the cross-target; add a validation step after running
prune-llvm-bin.py and before uploading the GH artifact "llvm-pruned-libs-${{
matrix.os }}" that either (a) generates a per-target manifest by running the
pruning script on the target toolchain/headers, or (b) performs a small
smoke/link test that compiles and links a minimal program against the pruned
install at .llvm/build-install/lib (using the matrix.target_triple and matrix.os
environment) to ensure all required libraries are present; implement the smoke
test as a new step that returns non-zero on failure so the job fails before
publishing the artifact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pixi.toml`:
- Line 43: The change added a new workspace constraint sysroot_linux-aarch64 =
"==2.17" in pixi.toml but the pixi.lock file is now out of sync; regenerate the
lock and commit it by running `pixi lock` locally (or in CI), verify the updated
pixi.lock contains the new sysroot_linux-aarch64 entry, and include the updated
pixi.lock in the commit so the pipeline no longer fails.

---

Nitpick comments:
In @.github/workflows/build-llvm.yml:
- Around line 226-235: The case block that sets ARCH/PLATFORM/TOOLCHAIN for
matrix.target_triple can leave those variables unset for typos or unknown
triples; add a default/fallback case in the case statement (for the block
handling "${{ matrix.target_triple }}") that logs an explicit error mentioning
the unrecognized target triple and exits non‑zero, and also after the case
ensure a guard that checks ARCH/PLATFORM/TOOLCHAIN are set (e.g., test -n
"$ARCH" && ...) to fail fast; update references to ARCH/PLATFORM/TOOLCHAIN in
the surrounding script to rely on this explicit failure rather than producing
malformed artifact names.
- Around line 198-216: The workflow applies a native ARCH manifest using the
step named "Apply pruned-libs manifest (cross-compile + LTO)" (which calls
scripts/prune-llvm-bin.py with MANIFEST="pruned-libs-${{ matrix.os }}.json") but
never verifies the pruned install for the cross-target; add a validation step
after running prune-llvm-bin.py and before uploading the GH artifact
"llvm-pruned-libs-${{ matrix.os }}" that either (a) generates a per-target
manifest by running the pruning script on the target toolchain/headers, or (b)
performs a small smoke/link test that compiles and links a minimal program
against the pruned install at .llvm/build-install/lib (using the
matrix.target_triple and matrix.os environment) to ensure all required libraries
are present; implement the smoke test as a new step that returns non-zero on
failure so the job fails before publishing the artifact.

In `@config/llvm-manifest.json`:
- Line 1: The LLVM manifest file was cleared for the 21.1.8 upgrade which leaves
pick_artifact() unable to find artifacts and will block builds; after merging,
immediately run the build workflow (build-llvm.yml) to produce artifacts and
then run the upload workflow (upload-llvm.yml) to update
config/llvm-manifest.json so pick_artifact() can locate matches; verify the
manifest is populated and that pick_artifact() succeeds in CI before closing the
change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fbdf875e-89a4-43b2-98a1-39a2520a9284

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd94e5 and 13cb0b1.

📒 Files selected for processing (9)
  • .github/workflows/build-llvm.yml
  • .github/workflows/publish-clice.yml
  • cmake/llvm.cmake
  • cmake/package.cmake
  • cmake/toolchain.cmake
  • config/llvm-manifest.json
  • pixi.toml
  • scripts/build-llvm.py
  • scripts/setup-llvm.py

Comment thread pixi.toml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/build-llvm.yml (1)

224-246: Consider adding a fallback case for unknown target triples.

The case statement handles the three expected target triples but lacks a default case. If a new target triple is added to the matrix without updating this packaging block, ARCH, PLATFORM, and TOOLCHAIN would remain unset, causing a confusing packaging failure downstream.

🛡️ Proposed fix to add a fallback case
           case "${{ matrix.target_triple }}" in
             x86_64-apple-darwin)
               ARCH="x64"; PLATFORM="macos"; TOOLCHAIN="clang" ;;
             aarch64-linux-gnu)
               ARCH="aarch64"; PLATFORM="linux"; TOOLCHAIN="gnu" ;;
             aarch64-pc-windows-msvc)
               ARCH="aarch64"; PLATFORM="windows"; TOOLCHAIN="msvc" ;;
+            *)
+              echo "Error: Unknown target triple '${{ matrix.target_triple }}'"
+              exit 1 ;;
           esac
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build-llvm.yml around lines 224 - 246, The case handling
for "${{ matrix.target_triple }}" can leave ARCH/PLATFORM/TOOLCHAIN unset for
unknown triples; add a fallback branch (the *) in that case statement to either
set sensible defaults (e.g., ARCH="x64", PLATFORM="linux", TOOLCHAIN="gnu") or
emit a clear error and exit, and include a warning message that shows the
unrecognized "${{ matrix.target_triple }}" so downstream packaging doesn't run
with empty variables.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/build-llvm.yml:
- Around line 224-246: The case handling for "${{ matrix.target_triple }}" can
leave ARCH/PLATFORM/TOOLCHAIN unset for unknown triples; add a fallback branch
(the *) in that case statement to either set sensible defaults (e.g.,
ARCH="x64", PLATFORM="linux", TOOLCHAIN="gnu") or emit a clear error and exit,
and include a warning message that shows the unrecognized "${{
matrix.target_triple }}" so downstream packaging doesn't run with empty
variables.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 450a2b15-6fee-4107-bda9-0c147c4c5182

📥 Commits

Reviewing files that changed from the base of the PR and between d66e891 and 300a5aa.

📒 Files selected for processing (1)
  • .github/workflows/build-llvm.yml

@16bit-ykiko
16bit-ykiko force-pushed the feature/cross-compile branch from 510693d to db37b30 Compare April 12, 2026 11:34
16bit-ykiko and others added 26 commits April 18, 2026 14:06
Add CLICE_TARGET_TRIPLE to toolchain.cmake for cross-compilation.
Upgrade LLVM from 21.1.4 to 21.1.8 and switch publish workflow
from xmake to CMake.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Create three dedicated environments (cross-macos-x64, cross-linux-aarch64,
cross-windows-arm64) instead of mixing cross-compile deps into the
native build environment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
LLVM_USE_SANITIZER=Address is not supported on Windows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The toolchain.cmake already sets the correct linker (lld-link on Windows,
lld elsewhere). LLVM's HandleLLVMOptions.cmake was adding a conflicting
-fuse-ld=lld on top of the toolchain's -fuse-ld=lld-link, causing link
failures on Windows LTO builds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
LLVM's HandleLLVMOptions generates MSVC-style linker flags (/opt:lldlto,
/lldltocache) when LTO is enabled. These are interpreted as file paths by
the clang++ GNU driver. Explicitly setting LLVM_USE_LINKER=lld-link tells
LLVM's CMake to use the correct flag style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
clang++ (GNU driver) cannot handle MSVC-style linker flags like
/lldltocache: and /opt:lldlto= that LLVM's CMake generates when
LTO is enabled. Switch to clang-cl (MSVC driver) on Windows which
natively understands these flags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The package pixi environment doesn't include uv, causing 'uv: command
not found' when running integration tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add llvm_version and skip_upload inputs to build-llvm workflow
- Add upload job to auto-publish artifacts to clice-llvm repo
- Add update-clice job to auto-create PR with version bump
- Extract distribution components list to scripts/llvm-components.json
- Add validate-llvm-components.py to catch stale/renamed components
- Add update-llvm-version.py to update manifest and package.cmake

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LLVM 21.1.8 changed clang-resource-headers from add_custom_target to
add_library(... INTERFACE ...). Add add_library pattern to header
scanning so the validation script can detect it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allow uploading artifacts to clice-llvm without creating a PR to
update the clice repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add architecture (x64/arm64) field to manifest entries so that
pick_artifact can correctly select the right artifact when multiple
architectures exist for the same platform. Update setup-llvm.py with
--target-arch argument and cmake/llvm.cmake to pass it from
CLICE_TARGET_TRIPLE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Revert to 21.1.4+r1 for this PR (version upgrade should come via the
automated workflow). Add missing Windows Debug entry to build-llvm
matrix. Manifest now includes arch field for all entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update LLVM from 21.1.4+r1 to 21.1.8
- Add cross-compile build targets to test-cmake.yml:
  macOS x64, Linux arm64, Windows arm64
- Cross-compile jobs build only (no tests)
- Windows Debug artifact pending from build-llvm workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GitHub Actions include with cartesian product doesn't create new
entries - switch to explicit include-only matrix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When cross-compiling, the built flatc is for the target architecture
and cannot run on the host. Use find_program to locate a host flatc
instead. Add flatbuffers conda package to provide it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The flatc version must match the FetchContent flatbuffers library
version (v25.9.23) to avoid schema_generated.h compatibility errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
clang-cl's -fsanitize=address is incompatible with -MDd (dynamic
debug CRT). Skip ASAN on Windows and remove -asan suffix from the
Windows Debug artifact name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On Windows, build-llvm.py uses clang-cl directly instead of the
toolchain file, so CLICE_TARGET_TRIPLE wasn't setting the compiler
target. Pass --target=<triple> via CMAKE_C/CXX_FLAGS and set
LLVM_HOST_TRIPLE for correct cross-compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When cross-compiling LLVM (Linux aarch64 from x64, Windows ARM64 from
x64), tablegen tools are compiled for the target architecture but must
run on the host during the build.  Add a two-stage build: first compile
native llvm-tblgen, llvm-min-tblgen, and clang-tblgen, then pass
LLVM_NATIVE_TOOL_DIR to the cross-compile build.

macOS cross-compilation is excluded because Rosetta 2 transparently
runs x86_64 tools on ARM64 hosts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16bit-ykiko and others added 17 commits April 18, 2026 14:06
Replace cross-compile + build-only with a native build on
windows-11-arm runner. This allows running full tests (unit,
integration, smoke) on ARM64 Windows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pixi-managed clang on windows-11-arm is an x64 binary running
under emulation, defaulting to x64 code generation.  Pass
CLICE_TARGET_TRIPLE so it generates ARM64 code that matches the
ARM64 LLVM libraries.  Tests still run natively on the ARM64 runner.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace cross-compilation with native runners:
- macOS x86_64: macos-13 (Intel) instead of Rosetta on macos-15
- Linux aarch64: ubuntu-24.04-arm instead of QEMU on ubuntu-24.04
- Windows ARM64: windows-11-arm (kept from previous commit)

Remove QEMU setup step and build_only logic since all platforms now
build and test natively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
macos-13 runner is no longer available and ubuntu-24.04-arm lacks
pixi linux-aarch64 platform packages.  Revert these two to the
proven cross-compile approach (Rosetta / QEMU).  Keep windows-11-arm
native runner which works.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…transfer

Cross-compile on pixi-supported platforms, upload binaries, then run tests
on native runners (macos-15-intel, ubuntu-24.04-arm) instead of QEMU/Rosetta.
Add test-run pixi environment for lightweight test-only platform support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use cross-linux-aarch64 pixi env for Linux aarch64 cross-compilation
  (provides sysroot, fixes Exec format error on native ARM64 runner)
- Upload lib/ directory alongside bin/ (clang resource dir needed by tests)
- Remove unnecessary platform restrictions from build/format features

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tforms

- Add win-arm64 to pixi platforms (6 total)
- Move Windows ARM64 from native build to cross-compile from windows-2025
- All 3 new platforms (macOS x64, Linux aarch64, Windows ARM64) use the
  same pattern: cross-compile on original platform, test on native runner
- Move flatbuffers from workspace deps to build feature (unavailable on win-arm64)
- Add platform restrictions for build/format/node features (native tools
  like cmake, ruff, pnpm unavailable on win-arm64)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The regex `^aarch64-.*-linux` requires a vendor segment between arch and
os (e.g. aarch64-unknown-linux-gnu) but the triple `aarch64-linux-gnu`
has no vendor. Change to `^aarch64-.*linux` to match both forms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Conda's ld_impl_linux-64 sets LIBRARY_PATH=$CONDA_PREFIX/lib which
contains x86_64 libgcc_s.so.1. When cross-compiling for aarch64, lld
finds this incompatible library and fails. Add activation script to
clear LIBRARY_PATH in the cross-linux-aarch64 environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pixi's activation script `unset` doesn't propagate through its
environment capture mechanism. Use `env -u LIBRARY_PATH` to strip
the host x86_64 library path directly before cmake invocation,
preventing lld from finding incompatible libgcc_s.so.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Conda's cross-compilation toolchain sets LDFLAGS with
-L$CONDA_PREFIX/lib pointing to host x86_64 libraries. CMake
picks up LDFLAGS from the environment, causing lld to find
incompatible libgcc_s.so.1. Strip all conda compiler flags
since our toolchain.cmake provides the correct settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- build-llvm.py: clear LDFLAGS/CFLAGS/LIBRARY_PATH when cross-compiling
  to prevent conda's host-platform flags from leaking into the target build
- build-llvm.yml: use cross-linux-aarch64/cross-windows-arm64 pixi envs
  for cross-compile jobs (provides aarch64 sysroot)
- build-llvm.yml: add "Build clice" step for cross-compiled LLVM to
  catch architecture mismatches early
- build-llvm.yml: add binary architecture verification step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous 21.1.8 release contained x86_64 objects in the aarch64
package. After rebuilding with proper cross-compilation sysroot and
env var isolation, update the manifest with correct hashes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On macOS runners without upstream clang in PATH, clice falls back to
/usr/bin/clang++ (Apple's) which emits vendor-specific flags that
upstream LLVM 21 cannot parse, causing 28 unit test failures on
macos-15-intel. Add clang/clangxx to the test feature for macOS
platforms so test-run gets upstream clang.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integration tests use CMake with toolchain.cmake which requires
-fuse-ld=lld. Without lld in the test-run environment, CMake's
compiler check fails on macOS cross-compile test runners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@16bit-ykiko
16bit-ykiko force-pushed the feature/cross-compile branch from 1888a6f to 22f8924 Compare April 18, 2026 06:10
16bit-ykiko and others added 5 commits April 18, 2026 17:46
- publish-clice.yml: add pixi_env matrix entries and wrap cross-compile
  cmake calls in `pixi run -e $ENV -- env -u LIBRARY_PATH ...` so the
  aarch64 linker cannot pick up conda host libs during release packaging.
- build-llvm.py: move the env-var cleanup before build_native_tools so
  the native-tools configure isn't contaminated by target-arch link flags.
- setup-llvm.py: produce a clear error when manifest entries lack the
  new `arch` field instead of silently returning "no match".
- build-llvm.yml: upload cross-compiled clice artifacts and add a
  test-cross job that downloads them on native ARM/Intel runners and
  runs unit/integration/smoke tests.
- update-llvm-version.py: add a --check mode and wire it into
  check-format so every PR verifies the setup_llvm(...) regex and
  manifest schema still match what the auto-PR job expects.
- Remove decorative banner comments introduced by this branch across
  the workflow files, pixi.toml, and validate-llvm-components.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop the "extra" arg workaround in pixi.toml now that pixi supports
verbatim passthrough via `--`. Route all CI clice builds through pixi
tasks (cmake-config/cmake-build/package-config) instead of raw cmake,
so LLVM-path and toolchain conventions stay centralized.

Move conda-flag clearing for cross builds into per-feature activation
scripts (linux/macos/windows), using `export VAR=` which reliably
overrides conda values; drop the `env -u LIBRARY_PATH` CI wrappers.
The new `--` passthrough syntax used in task invocations requires a
recent pixi. Align CI with the local version used for verification.
Drop the only remaining inline `prefix-dev/setup-pixi` invocation so
every workflow goes through `.github/actions/setup-pixi`. This keeps
the pixi version pinned in a single place for future bumps.
Add smoke-test to the `test` pixi task and collapse the per-phase
workflow steps into a single `pixi run test` invocation in build-llvm
and test-cmake. This fills a gap in the native build-llvm job, which
previously skipped the smoke phase, and keeps the one-command form
identical between CI and local dev.

The collapse drops the `if: success() || failure()` guard that used
to run smoke even when integration failed. That signal is minor and
not worth fanning the pipeline back out for.
@16bit-ykiko
16bit-ykiko merged commit 592b374 into main Apr 18, 2026
20 checks passed
@16bit-ykiko
16bit-ykiko deleted the feature/cross-compile branch April 18, 2026 16:17
@coderabbitai coderabbitai Bot mentioned this pull request Jun 8, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant