Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7a08e76
chore(build): bump toolchain to clang 22.1.8 and gcc 15.1.0
16bit-ykiko Jul 23, 2026
d8089d9
fix(build): override CMAKE_LIBTOOL on macOS for LTO compatibility
16bit-ykiko Jul 23, 2026
64ecce6
fix(ci): use correct MSVC arch for ARM64 cross-compilation
16bit-ykiko Jul 23, 2026
0af8049
fix(ci): skip MSVC toolset pin for cross-compilation jobs
16bit-ykiko Jul 23, 2026
062f4de
fix(ci): use VCToolsVersion env var instead of ilammy/msvc-dev-cmd
16bit-ykiko Jul 23, 2026
bc10fcb
fix(build): disable DIA SDK and pin MSVC via ilammy action
16bit-ykiko Jul 23, 2026
5c9b37c
fix(build): patch LLVM 21.1.8 for libc++ 22 transparent comparator
16bit-ykiko Jul 23, 2026
14b1ca6
fix(ci): use curl+git-apply instead of cherry-pick for LLVM patch
16bit-ykiko Jul 23, 2026
b0eca23
fix(ci): use PR URL for LLVM patch (commit URL returns 404)
16bit-ykiko Jul 23, 2026
1d26178
ci(build-llvm): apply patches from clice-llvm before building
16bit-ykiko Jul 23, 2026
959e64b
ci(build-llvm): simplify patch step, single llvm_version input
16bit-ykiko Jul 23, 2026
a81ad94
ci(build-llvm): add patch_ref input for reproducible builds
16bit-ykiko Jul 23, 2026
ae7fccc
fix(ci): use absolute patch path, remove MSVC pin
16bit-ykiko Jul 23, 2026
9b26456
fix(ci): pin MSVC to 14.44 (pre-installed v143 compat toolset)
16bit-ykiko Jul 23, 2026
de290f1
fix(ci): set MSVC arch for ARM64 cross builds
16bit-ykiko Jul 23, 2026
9d47b96
fix(ci): skip MSVC pin for ARM64 cross (conflicts with native tools)
16bit-ykiko Jul 23, 2026
edf2ae9
fix(build): pass vendor availability annotations to LLVM build on macOS
16bit-ykiko Jul 24, 2026
ee80acb
fix(build): correct MSVC pin and macOS availability annotations
16bit-ykiko Jul 24, 2026
0789f4a
fix(build): pin MSVC 14.44 via /vctoolsversion in build-llvm.py
16bit-ykiko Jul 24, 2026
ae7dab0
fix(build): pin MSVC toolset via vcvarsall.bat in build-llvm.py
16bit-ykiko Jul 24, 2026
4e1282c
fix(build): revert vcvarsall approach, use ilammy for native only
16bit-ykiko Jul 24, 2026
f7c83b5
ci(build-llvm): remove MSVC toolset pin for now
16bit-ykiko Jul 24, 2026
3393a2e
ci(build-llvm): use windows-2022 runner (VS 2022 / toolset v143)
16bit-ykiko Jul 24, 2026
4a680ec
chore(build): upgrade LLVM prebuilt to 21.1.8+r2
16bit-ykiko Jul 24, 2026
25a9a47
style: format build-llvm.py
16bit-ykiko Jul 24, 2026
1685e6e
fix(build): strip kotatsu _LIBCPP_DISABLE_AVAILABILITY
16bit-ykiko Jul 24, 2026
4f3702c
chore(build): drop redundant libc++ availability defines
16bit-ykiko Jul 24, 2026
3e938b0
fix(build): disable conda clang default config on macOS
16bit-ykiko Jul 24, 2026
c6345d6
chore(build): drop dead macos cross activation script
16bit-ykiko Jul 24, 2026
3d69567
refactor(build): move conda toolchain flags into toolchain file
16bit-ykiko Jul 24, 2026
56707a1
fix(build): rpath debug binaries to env libc++ on macOS
16bit-ykiko Jul 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions .github/workflows/build-llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
description: "LLVM version to build (e.g., 21.1.8)"
required: true
type: string
patch_ref:
description: "clice-llvm ref for patches (default: main). Set to a release tag (e.g., 21.1.8+r2) to reproduce a previous build."
required: false
default: "main"
type: string
Comment thread
16bit-ykiko marked this conversation as resolved.
Resolved

concurrency:
group: build-llvm-${{ github.ref }}
Expand All @@ -19,10 +24,10 @@ jobs:
matrix:
include:
# Native builds
- os: windows-2025
- os: windows-2022
llvm_mode: RelWithDebInfo
lto: OFF
- os: windows-2025
- os: windows-2022
llvm_mode: RelWithDebInfo
lto: ON
- os: ubuntu-24.04
Expand Down Expand Up @@ -67,13 +72,13 @@ jobs:
target_triple: aarch64-linux-gnu
pixi_env: cross-linux-arm64

# Windows arm64 (from x64 windows-2025)
- os: windows-2025
# Windows arm64 (from x64 windows-2022)
- os: windows-2022
llvm_mode: RelWithDebInfo
lto: OFF
target_triple: aarch64-pc-windows-msvc
pixi_env: cross-windows-arm64
- os: windows-2025
- os: windows-2022
llvm_mode: RelWithDebInfo
lto: ON
target_triple: aarch64-pc-windows-msvc
Expand Down Expand Up @@ -155,6 +160,29 @@ jobs:
echo "Cloning LLVM ${VERSION}..."
git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm

- name: Apply patches
shell: bash
run: |
VERSION="${{ inputs.llvm_version || '21.1.8' }}"
REF="${{ inputs.patch_ref || 'main' }}"
Comment thread
16bit-ykiko marked this conversation as resolved.
Resolved

if git clone --branch "$REF" --depth 1 https://github.com/clice-io/clice-llvm.git .clice-llvm 2>/dev/null; then
echo "Using patches from clice-llvm@$REF"
else
echo "Ref '$REF' not found, falling back to main"
git clone --depth 1 https://github.com/clice-io/clice-llvm.git .clice-llvm
Comment thread
16bit-ykiko marked this conversation as resolved.
Resolved
fi

PATCH_DIR=".clice-llvm/patches/${VERSION}"
if [ -d "$PATCH_DIR" ] && ls "$PATCH_DIR"/*.patch >/dev/null 2>&1; then
for patch in "$PATCH_DIR"/*.patch; do
echo "Applying $(basename "$patch")..."
git -C .llvm apply "$(pwd)/$patch"
done
else
echo "No patches for LLVM ${VERSION}"
fi

- name: Build LLVM (install-distribution)
shell: bash
run: |
Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ if(NOT MSVC)
endif()

if(APPLE)
# https://conda-forge.org/docs/maintainer/knowledge_base/#newer-c-features-with-old-sdk
add_compile_definitions(_LIBCPP_DISABLE_AVAILABILITY=1)
# conda-forge clang 22 ships default config files (<triple>-clang++.cfg)
# that inject -L/-rpath to the env's lib dir at link time, binding
# binaries to conda's @rpath libc++ — they then fail to load anywhere
# outside the build machine. Disable config files: libc++ headers are
# still found relative to the driver, and the link falls back to the
# SDK's system libc++ (safe thanks to availability annotations).
add_compile_options(--no-default-config)
string(APPEND CMAKE_EXE_LINKER_FLAGS " --no-default-config")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " --no-default-config")
endif()
Comment thread
16bit-ykiko marked this conversation as resolved.
Resolved

# Keyed on the target OS, not the compiler frontend: CI links Windows with
Expand Down
28 changes: 27 additions & 1 deletion cmake/package.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include_guard()

include(${CMAKE_CURRENT_LIST_DIR}/llvm.cmake)
setup_llvm("21.1.8+r1")
setup_llvm("21.1.8+r2")

# install dependencies
include(FetchContent)
Expand Down Expand Up @@ -53,3 +53,29 @@ set(KOTA_ENABLE_EXCEPTIONS OFF)
set(KOTA_ENABLE_RTTI OFF)

FetchContent_MakeAvailable(kotatsu spdlog croaring flatbuffers)

# kotatsu adds -D_LIBCPP_DISABLE_AVAILABILITY globally; on macOS with
# libc++ >= 21 that makes the headers emit references to dylib-only symbols
# (__hash_memory, llvm-project#77653) that the system libc++ lacks, breaking
# the x64 cross link and poisoning shipped binaries. Directory COMPILE_OPTIONS
# are copied into each target at creation time, so walk targets (not the
# directory property) and strip the flag from every kotatsu target. Temporary
# until the flag is removed upstream in kotatsu.
function(clice_strip_disable_availability dir)
get_directory_property(targets DIRECTORY "${dir}" BUILDSYSTEM_TARGETS)
foreach(target IN LISTS targets)
get_target_property(target_type ${target} TYPE)
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
get_target_property(options ${target} COMPILE_OPTIONS)
if(options)
list(REMOVE_ITEM options "-D_LIBCPP_DISABLE_AVAILABILITY")
set_target_properties(${target} PROPERTIES COMPILE_OPTIONS "${options}")
endif()
endif()
endforeach()
get_directory_property(subdirs DIRECTORY "${dir}" SUBDIRECTORIES)
foreach(subdir IN LISTS subdirs)
clice_strip_disable_availability("${subdir}")
endforeach()
endfunction()
clice_strip_disable_availability("${kotatsu_SOURCE_DIR}")
14 changes: 14 additions & 0 deletions cmake/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ if(LLVM_RANLIB_PATH)
set(CMAKE_CXX_COMPILER_RANLIB "${LLVM_RANLIB_PATH}" CACHE FILEPATH "")
endif()

# On macOS, CMake's Ninja generator uses libtool instead of ar for static
# libraries. Apple's libtool cannot read bitcode from newer LLVM versions
# (e.g. attribute kind 102 from LLVM 22), breaking LTO builds. Use LLVM's
# llvm-libtool-darwin if available; otherwise suppress CMAKE_LIBTOOL so
# CMake falls back to CMAKE_AR (llvm-ar handles bitcode correctly).
if(APPLE)
Comment thread
16bit-ykiko marked this conversation as resolved.
Resolved
find_program(LLVM_LIBTOOL_PATH "llvm-libtool-darwin")
if(LLVM_LIBTOOL_PATH)
set(CMAKE_LIBTOOL "${LLVM_LIBTOOL_PATH}" CACHE FILEPATH "")
else()
set(CMAKE_LIBTOOL "CMAKE_LIBTOOL-NOTFOUND" CACHE FILEPATH "")
endif()
endif()

find_program(LLVM_NM_PATH "llvm-nm")
if(LLVM_NM_PATH)
set(CMAKE_NM "${LLVM_NM_PATH}" CACHE FILEPATH "")
Expand Down
Loading
Loading