From 9f3b2468fc08491c6d905b92590dacb377a14f81 Mon Sep 17 00:00:00 2001 From: Clementine Pendragon Date: Wed, 1 Jul 2026 22:05:56 -0600 Subject: [PATCH 1/5] feat: musl builds --- .github/workflows/release.yml | 124 ++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e8074d48ae4..5456c7f8e54d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -581,6 +581,124 @@ jobs: path: llama-bin-ubuntu-openvino-${{ env.OPENVINO_VERSION_MAJOR }}-x64.tar.gz name: llama-bin-ubuntu-openvino-${{ env.OPENVINO_VERSION_MAJOR }}-x64.tar.gz + # ======================================================================== + # musl (Alpine) — CPU. Upstream ggml-org ships only glibc ("ubuntu") Linux + # builds, so lemonade pulls musl CPU/Vulkan binaries from this fork instead. + # The source is cloned on the (glibc) host but compiled inside an Alpine + # container so it links musl. libstdc++/libgcc are linked statically and + # OpenMP is disabled so the tarball is self-contained (only musl libc, and + # for Vulkan libvulkan, are needed at runtime). + # ======================================================================== + linux-musl-cpu: + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + arch: x64 + cpu_variants: "ON" + - runner: ubuntu-24.04-arm + arch: arm64 + cpu_variants: "OFF" + runs-on: ${{ matrix.runner }} + + steps: + - name: Clone + uses: actions/checkout@v6 + with: + fetch-depth: 0 + repository: 'ggml-org/llama.cpp' + + - name: Build (Alpine / musl) + run: | + docker run --rm -v "$PWD:/src" -w /src alpine:latest sh -euxc ' + apk add --no-cache build-base cmake git linux-headers + cmake -B build -S . \ + -DCMAKE_BUILD_TYPE=Release \ + -DGGML_NATIVE=OFF \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=${{ matrix.cpu_variants }} \ + -DGGML_OPENMP=OFF \ + -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ + -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ + ${{ env.CMAKE_ARGS }} + cmake --build build --config Release -j"$(nproc)" + chmod -R a+rwX build + ' + + - name: Determine tag name + id: tag + uses: lemonade-sdk/llama.cpp/.github/actions/get-tag-name@lemonade + + - name: Pack artifacts + run: | + cp LICENSE ./build/bin/ + tar -czvf llama-bin-linux-musl-${{ matrix.arch }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin . + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + path: llama-bin-linux-musl-${{ matrix.arch }}.tar.gz + name: llama-bin-linux-musl-${{ matrix.arch }}.tar.gz + + # ======================================================================== + # musl (Alpine) — Vulkan. Needs vulkan-loader + a GLSL compiler at build; + # the target Alpine host must have vulkan-loader and a Vulkan driver (Mesa). + # ======================================================================== + linux-musl-vulkan: + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + arch: x64 + cpu_variants: "ON" + - runner: ubuntu-24.04-arm + arch: arm64 + cpu_variants: "OFF" + runs-on: ${{ matrix.runner }} + + steps: + - name: Clone + uses: actions/checkout@v6 + with: + fetch-depth: 0 + repository: 'ggml-org/llama.cpp' + + - name: Build (Alpine / musl) + run: | + docker run --rm -v "$PWD:/src" -w /src alpine:latest sh -euxc ' + apk add --no-cache build-base cmake git linux-headers \ + vulkan-loader-dev vulkan-headers glslang shaderc spirv-tools + cmake -B build -S . \ + -DCMAKE_BUILD_TYPE=Release \ + -DGGML_NATIVE=OFF \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=${{ matrix.cpu_variants }} \ + -DGGML_OPENMP=OFF \ + -DGGML_VULKAN=ON \ + -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ + -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ + ${{ env.CMAKE_ARGS }} + cmake --build build --config Release -j"$(nproc)" + chmod -R a+rwX build + ' + + - name: Determine tag name + id: tag + uses: lemonade-sdk/llama.cpp/.github/actions/get-tag-name@lemonade + + - name: Pack artifacts + run: | + cp LICENSE ./build/bin/ + tar -czvf llama-bin-linux-musl-vulkan-${{ matrix.arch }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin . + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + path: llama-bin-linux-musl-vulkan-${{ matrix.arch }}.tar.gz + name: llama-bin-linux-musl-vulkan-${{ matrix.arch }}.tar.gz + windows-cpu: runs-on: windows-2025 @@ -916,6 +1034,8 @@ jobs: - ubuntu-22-cuda - ubuntu-22-cuda-arm64 - ubuntu-22-openvino + - linux-musl-cpu + - linux-musl-vulkan steps: - name: Clone @@ -1050,6 +1170,10 @@ jobs: '- Ubuntu x64 (CUDA): `llama-' + tag + '-ubuntu-cuda-sm_XX-x64.tar.xz` (replace XX with your GPU compute capability)', '- Ubuntu arm64 (CUDA): `llama-' + tag + '-ubuntu-cuda-sm_XX-arm64.tar.xz` (replace XX with your GPU compute capability)', `- [Ubuntu x64 (OpenVINO 2026.0)](https://github.com/${owner}/${repo}/releases/download/${tag}/llama-${tag}-bin-ubuntu-openvino-2026.0-x64.tar.gz)`, + `- [Alpine/musl x64 (CPU)](https://github.com/${owner}/${repo}/releases/download/${tag}/llama-${tag}-bin-linux-musl-x64.tar.gz)`, + `- [Alpine/musl arm64 (CPU)](https://github.com/${owner}/${repo}/releases/download/${tag}/llama-${tag}-bin-linux-musl-arm64.tar.gz)`, + `- [Alpine/musl x64 (Vulkan)](https://github.com/${owner}/${repo}/releases/download/${tag}/llama-${tag}-bin-linux-musl-vulkan-x64.tar.gz)`, + `- [Alpine/musl arm64 (Vulkan)](https://github.com/${owner}/${repo}/releases/download/${tag}/llama-${tag}-bin-linux-musl-vulkan-arm64.tar.gz)`, '', '**Windows:**', `- [Windows x64 (ROCm 7.13)](https://github.com/${owner}/${repo}/releases/download/${tag}/llama-${tag}-bin-win-rocm-7.13-x64.zip)`, From afbd768f36b27cd2bfc3e147dffab261c23abd33 Mon Sep 17 00:00:00 2001 From: Clementine Pendragon Date: Wed, 1 Jul 2026 22:53:40 -0600 Subject: [PATCH 2/5] add vulkan dependencies for build --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5456c7f8e54d..206430b9cc03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -669,7 +669,7 @@ jobs: run: | docker run --rm -v "$PWD:/src" -w /src alpine:latest sh -euxc ' apk add --no-cache build-base cmake git linux-headers \ - vulkan-loader-dev vulkan-headers glslang shaderc spirv-tools + vulkan-loader-dev vulkan-headers glslang shaderc spirv-tools spirv-headers cmake -B build -S . \ -DCMAKE_BUILD_TYPE=Release \ -DGGML_NATIVE=OFF \ From 222ec2db7d6daeaf94e3d8108f4939c7583587a7 Mon Sep 17 00:00:00 2001 From: Clementine Pendragon Date: Thu, 2 Jul 2026 10:19:17 -0600 Subject: [PATCH 3/5] improve asset fetching --- .github/workflows/release.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 206430b9cc03..21011f6f5bde 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,11 @@ on: description: 'Create new release' required: true type: boolean + llama_ref: + description: 'Upstream ggml-org/llama.cpp tag to build (must match lemonade backend_versions.json)' + required: false + default: 'b9747' + type: string pull_request: # validate the release build on PRs; the release job is skipped so nothing is published paths: # The build jobs clone llama.cpp source from upstream and the get-tag-name @@ -23,6 +28,9 @@ concurrency: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON" + # Upstream tag every job checks out. Pinned so get-tag-name (b) + # emits this version and the release matches lemonade's backend_versions.json. + LLAMA_REF: ${{ github.event.inputs.llama_ref || 'b9747' }} jobs: ubuntu-22-rocm: @@ -42,6 +50,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: ccache uses: ggml-org/ccache-action@v1.2.21 @@ -142,6 +151,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: ccache uses: ggml-org/ccache-action@v1.2.21 @@ -300,6 +310,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: ccache uses: ggml-org/ccache-action@v1.2.21 @@ -455,6 +466,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: ccache uses: ggml-org/ccache-action@v1.2.21 @@ -608,6 +620,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: Build (Alpine / musl) run: | @@ -664,6 +677,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: Build (Alpine / musl) run: | @@ -714,6 +728,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: ccache uses: ggml-org/ccache-action@v1.2.21 @@ -787,6 +802,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: Cache ROCm Installation id: cache-rocm @@ -895,6 +911,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: Install CUDA Toolkit uses: Jimver/cuda-toolkit@v0.2.35 @@ -1044,6 +1061,7 @@ jobs: with: fetch-depth: 0 repository: 'ggml-org/llama.cpp' + ref: ${{ env.LLAMA_REF }} - name: Determine tag name id: tag From 64bbee1d5d9cd249bfef41c0341fb9f96b3255cc Mon Sep 17 00:00:00 2001 From: Clementine Pendragon Date: Thu, 2 Jul 2026 15:06:04 -0600 Subject: [PATCH 4/5] ci(musl): emit $ORIGIN-relative rpath so relocated binaries find sibling libs --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 225e370e1fe2..bc07e0dcf16f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -632,6 +632,7 @@ jobs: -DGGML_BACKEND_DL=ON \ -DGGML_CPU_ALL_VARIANTS=${{ matrix.cpu_variants }} \ -DGGML_OPENMP=OFF \ + -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ ${{ env.CMAKE_ARGS }} @@ -691,6 +692,7 @@ jobs: -DGGML_CPU_ALL_VARIANTS=${{ matrix.cpu_variants }} \ -DGGML_OPENMP=OFF \ -DGGML_VULKAN=ON \ + -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ ${{ env.CMAKE_ARGS }} From 2c2ce850fad85d72a32306987f7b0a51ede8c6bf Mon Sep 17 00:00:00 2001 From: Clementine Pendragon Date: Fri, 3 Jul 2026 02:44:41 -0600 Subject: [PATCH 5/5] schedule track upstream --- .github/workflows/release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc07e0dcf16f..0451dacc28d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,9 +28,12 @@ concurrency: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON" - # Upstream tag every job checks out. Pinned so get-tag-name (b) - # emits this version and the release matches lemonade's backend_versions.json. - LLAMA_REF: ${{ github.event.inputs.llama_ref || 'b9747' }} + # Upstream ref every job checks out. Empty on schedule/PR (no inputs) so + # actions/checkout uses ggml-org's default branch = latest — this preserves the + # fork's original "track upstream" nightly behavior. A manual dispatch defaults + # to the llama_ref input (b9747) so a deliberate build matches lemonade's + # backend_versions.json pin. + LLAMA_REF: ${{ github.event.inputs.llama_ref }} jobs: ubuntu-22-rocm: