https://github.com/eirikr-zhong created
https://github.com/llvm/llvm-project/pull/187978
None
>From de20c1c74f835dc55f28bcc4d613aa806a1fe01f Mon Sep 17 00:00:00 2001
From: Codex <codex@local>
Date: Thu, 5 Mar 2026 17:16:08 +0800
Subject: [PATCH 01/17] ci: add manual alpine static llvm package workflow with
sccache and zstd
---
.github/workflows/alpine-static-package.yml | 153 ++++++++++++++++++++
1 file changed, 153 insertions(+)
create mode 100644 .github/workflows/alpine-static-package.yml
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
new file mode 100644
index 0000000000000..b402bafff7618
--- /dev/null
+++ b/.github/workflows/alpine-static-package.yml
@@ -0,0 +1,153 @@
+name: Alpine Static LLVM Package
+
+on:
+ workflow_dispatch:
+ inputs:
+ commit_id:
+ description: 'LLVM commit SHA to build'
+ required: true
+ type: string
+ lto_mode:
+ description: 'LTO mode'
+ required: false
+ default: 'Thin'
+ type: choice
+ options:
+ - Thin
+ - Full
+
+permissions:
+ contents: read
+
+jobs:
+ build-and-package:
+ name: Build clang/lld/lldb (alpine static)
+ runs-on: ubuntu-24.04
+ container:
+ image: alpine:3.20
+ env:
+ SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
+ CCACHE_BASEDIR: ${{ github.workspace }}/.cache/sccache
+ defaults:
+ run:
+ shell: sh
+ steps:
+ - name: Install build dependencies
+ run: |
+ set -eux
+ apk add --no-cache \
+ bash \
+ build-base \
+ ca-certificates \
+ clang \
+ cmake \
+ git \
+ lld \
+ linux-headers \
+ ninja \
+ perl \
+ python3 \
+ sccache \
+ swig \
+ zstd \
+ zstd-static \
+ zstd-dev \
+ xz \
+ xz-dev \
+ zlib-dev
+
+ - name: Checkout source
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Checkout target commit
+ run: |
+ set -eux
+ COMMIT_ID="${{ inputs.commit_id }}"
+ git rev-parse --verify "${COMMIT_ID}^{commit}"
+ git checkout --detach "${COMMIT_ID}"
+
+ - name: Restore sccache cache
+ uses: actions/cache@v4
+ with:
+ path: ${{ env.SCCACHE_DIR }}
+ key: sccache-alpine-static-${{ runner.os }}-${{ inputs.lto_mode
}}-${{ hashFiles('.github/workflows/alpine-static-package.yml') }}
+ restore-keys: |
+ sccache-alpine-static-${{ runner.os }}-${{ inputs.lto_mode }}-
+ sccache-alpine-static-${{ runner.os }}-
+
+ - name: Initialize sccache
+ run: |
+ set -eux
+ mkdir -p "${SCCACHE_DIR}"
+ sccache --version
+ sccache --zero-stats || true
+
+ - name: Configure (Release + LTO + static)
+ env:
+ CC: clang
+ CXX: clang++
+ run: |
+ set -eux
+ cmake -G Ninja -S llvm -B build \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_C_COMPILER=clang \
+ -DCMAKE_CXX_COMPILER=clang++ \
+ -DCMAKE_C_COMPILER_LAUNCHER=sccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
+ -DCMAKE_EXE_LINKER_FLAGS="-static -fuse-ld=lld" \
+ -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
+ -DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" \
+ -DLLVM_ENABLE_PROJECTS="clang;lld;lldb" \
+ -DLLVM_ENABLE_LTO="${{ inputs.lto_mode }}" \
+ -DLLVM_BUILD_LLVM_DYLIB=OFF \
+ -DLLVM_LINK_LLVM_DYLIB=OFF \
+ -DBUILD_SHARED_LIBS=OFF \
+ -DLLDB_ENABLE_PYTHON=OFF \
+ -DLLVM_ENABLE_TERMINFO=OFF \
+ -DLLVM_ENABLE_LIBEDIT=OFF \
+ -DLLVM_ENABLE_LIBXML2=OFF \
+ -DLLVM_ENABLE_ZSTD=FORCE_ON \
+ -DLLVM_INCLUDE_TESTS=OFF \
+ -DLLVM_INCLUDE_BENCHMARKS=OFF \
+ -DLLVM_INCLUDE_EXAMPLES=OFF
+
+ - name: Build
+ run: |
+ set -eux
+ ninja -C build clang lld lldb
+
+ - name: Show sccache stats
+ if: always()
+ run: |
+ set -eux
+ sccache --show-stats || true
+
+ - name: Install
+ run: |
+ set -eux
+ cmake --install build --prefix "$PWD/package"
+
+ - name: Verify static linkage (best effort)
+ run: |
+ set -eux
+ file package/bin/clang || true
+ file package/bin/ld.lld || true
+ file package/bin/lldb || true
+
+ - name: Create package
+ id: package
+ run: |
+ set -eux
+ SHORT_SHA=$(git rev-parse --short HEAD)
+ PKG_NAME="llvm-alpine-static-${SHORT_SHA}.tar.xz"
+ tar -C package -cJf "${PKG_NAME}" .
+ echo "pkg_name=${PKG_NAME}" >> "$GITHUB_OUTPUT"
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ steps.package.outputs.pkg_name }}
+ path: ${{ steps.package.outputs.pkg_name }}
+ if-no-files-found: error
>From 96b90d02bac3bdd58ef748124d61eb016fd276c1 Mon Sep 17 00:00:00 2001
From: Codex <codex@local>
Date: Thu, 5 Mar 2026 17:34:28 +0800
Subject: [PATCH 02/17] ci: trigger alpine static package workflow on
pull_request for debug
---
.github/workflows/alpine-static-package.yml | 31 +++++----------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index b402bafff7618..755695e815ade 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -1,20 +1,9 @@
name: Alpine Static LLVM Package
on:
- workflow_dispatch:
- inputs:
- commit_id:
- description: 'LLVM commit SHA to build'
- required: true
- type: string
- lto_mode:
- description: 'LTO mode'
- required: false
- default: 'Thin'
- type: choice
- options:
- - Thin
- - Full
+ pull_request:
+ branches:
+ - main
permissions:
contents: read
@@ -28,6 +17,7 @@ jobs:
env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
CCACHE_BASEDIR: ${{ github.workspace }}/.cache/sccache
+ LTO_MODE: Thin
defaults:
run:
shell: sh
@@ -61,20 +51,13 @@ jobs:
with:
fetch-depth: 0
- - name: Checkout target commit
- run: |
- set -eux
- COMMIT_ID="${{ inputs.commit_id }}"
- git rev-parse --verify "${COMMIT_ID}^{commit}"
- git checkout --detach "${COMMIT_ID}"
-
- name: Restore sccache cache
uses: actions/cache@v4
with:
path: ${{ env.SCCACHE_DIR }}
- key: sccache-alpine-static-${{ runner.os }}-${{ inputs.lto_mode
}}-${{ hashFiles('.github/workflows/alpine-static-package.yml') }}
+ key: sccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-${{
hashFiles('.github/workflows/alpine-static-package.yml') }}
restore-keys: |
- sccache-alpine-static-${{ runner.os }}-${{ inputs.lto_mode }}-
+ sccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-
sccache-alpine-static-${{ runner.os }}-
- name: Initialize sccache
@@ -100,7 +83,7 @@ jobs:
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" \
-DLLVM_ENABLE_PROJECTS="clang;lld;lldb" \
- -DLLVM_ENABLE_LTO="${{ inputs.lto_mode }}" \
+ -DLLVM_ENABLE_LTO="${LTO_MODE}" \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DBUILD_SHARED_LIBS=OFF \
>From 8c65ceb7359aa5ec4111b1929c8ae8eeabf59490 Mon Sep 17 00:00:00 2001
From: Codex <codex@local>
Date: Thu, 5 Mar 2026 17:55:30 +0800
Subject: [PATCH 03/17] ci: produce debug and stripped alpine static packages
---
.github/workflows/alpine-static-package.yml | 40 +++++++++++++++------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 755695e815ade..28d4fe3fc0a3c 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -39,7 +39,6 @@ jobs:
python3 \
sccache \
swig \
- zstd \
zstd-static \
zstd-dev \
xz \
@@ -67,14 +66,14 @@ jobs:
sccache --version
sccache --zero-stats || true
- - name: Configure (Release + LTO + static)
+ - name: Configure (RelWithDebInfo + LTO + static)
env:
CC: clang
CXX: clang++
run: |
set -eux
cmake -G Ninja -S llvm -B build \
- -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
@@ -119,18 +118,39 @@ jobs:
file package/bin/ld.lld || true
file package/bin/lldb || true
- - name: Create package
+ - name: Create debug-symbol package
id: package
run: |
set -eux
SHORT_SHA=$(git rev-parse --short HEAD)
- PKG_NAME="llvm-alpine-static-${SHORT_SHA}.tar.xz"
- tar -C package -cJf "${PKG_NAME}" .
- echo "pkg_name=${PKG_NAME}" >> "$GITHUB_OUTPUT"
+
DEBUG_PKG_NAME="llvm-alpine-static-relwithdebinfo-debug-${SHORT_SHA}.tar.xz"
+ tar -C package -cJf "${DEBUG_PKG_NAME}" .
+ echo "debug_pkg_name=${DEBUG_PKG_NAME}" >> "$GITHUB_OUTPUT"
- - name: Upload artifact
+ - name: Create stripped package
+ run: |
+ set -eux
+ cp -a package package-stripped
+ find package-stripped -type f | while read -r f; do
+ if file "$f" | grep -q 'ELF '; then
+ strip --strip-debug "$f" || true
+ fi
+ done
+ SHORT_SHA=$(git rev-parse --short HEAD)
+
STRIPPED_PKG_NAME="llvm-alpine-static-relwithdebinfo-stripped-${SHORT_SHA}.tar.xz"
+ tar -C package-stripped -cJf "${STRIPPED_PKG_NAME}" .
+ echo "stripped_pkg_name=${STRIPPED_PKG_NAME}" >> "$GITHUB_ENV"
+
+ - name: Upload debug-symbol artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ steps.package.outputs.debug_pkg_name }}
+ path: ${{ steps.package.outputs.debug_pkg_name }}
+ if-no-files-found: error
+
+ - name: Upload stripped artifact
uses: actions/upload-artifact@v4
with:
- name: ${{ steps.package.outputs.pkg_name }}
- path: ${{ steps.package.outputs.pkg_name }}
+ name: ${{ env.stripped_pkg_name }}
+ path: ${{ env.stripped_pkg_name }}
if-no-files-found: error
>From d19b6f0e83b67e596e91f40d219d95f12993e1e6 Mon Sep 17 00:00:00 2001
From: Codex <codex@local>
Date: Thu, 5 Mar 2026 17:59:53 +0800
Subject: [PATCH 04/17] ci: publish clang/lldb/ld and debug symbols artifacts
---
.github/workflows/alpine-static-package.yml | 65 +++++++++++++--------
1 file changed, 41 insertions(+), 24 deletions(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 28d4fe3fc0a3c..783ed801743f7 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -27,6 +27,7 @@ jobs:
set -eux
apk add --no-cache \
bash \
+ binutils \
build-base \
ca-certificates \
clang \
@@ -93,7 +94,8 @@ jobs:
-DLLVM_ENABLE_ZSTD=FORCE_ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
- -DLLVM_INCLUDE_EXAMPLES=OFF
+ -DLLVM_INCLUDE_EXAMPLES=OFF \
+ -DLLVM_USE_STATIC_ZSTD
- name: Build
run: |
@@ -118,39 +120,54 @@ jobs:
file package/bin/ld.lld || true
file package/bin/lldb || true
- - name: Create debug-symbol package
- id: package
+ - name: Prepare deliverables
+ id: deliverables
run: |
set -eux
SHORT_SHA=$(git rev-parse --short HEAD)
-
DEBUG_PKG_NAME="llvm-alpine-static-relwithdebinfo-debug-${SHORT_SHA}.tar.xz"
- tar -C package -cJf "${DEBUG_PKG_NAME}" .
- echo "debug_pkg_name=${DEBUG_PKG_NAME}" >> "$GITHUB_OUTPUT"
-
- - name: Create stripped package
- run: |
- set -eux
cp -a package package-stripped
- find package-stripped -type f | while read -r f; do
- if file "$f" | grep -q 'ELF '; then
- strip --strip-debug "$f" || true
- fi
+ mkdir -p debug_symbols
+
+ for bin in clang lldb ld.lld; do
+ objcopy --only-keep-debug "package/bin/${bin}"
"debug_symbols/${bin}.debug"
+ strip --strip-debug "package-stripped/bin/${bin}"
done
- SHORT_SHA=$(git rev-parse --short HEAD)
-
STRIPPED_PKG_NAME="llvm-alpine-static-relwithdebinfo-stripped-${SHORT_SHA}.tar.xz"
- tar -C package-stripped -cJf "${STRIPPED_PKG_NAME}" .
- echo "stripped_pkg_name=${STRIPPED_PKG_NAME}" >> "$GITHUB_ENV"
- - name: Upload debug-symbol artifact
+ cp "package-stripped/bin/clang" "clang-${SHORT_SHA}"
+ cp "package-stripped/bin/lldb" "lldb-${SHORT_SHA}"
+ cp "package-stripped/bin/ld.lld" "ld-${SHORT_SHA}"
+ chmod +x "clang-${SHORT_SHA}" "lldb-${SHORT_SHA}" "ld-${SHORT_SHA}"
+
+ tar -C debug_symbols -czf debug_symbols.tar.gz .
+
+ echo "clang_name=clang-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
+ echo "lldb_name=lldb-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
+ echo "ld_name=ld-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
+
+ - name: Upload clang artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ steps.deliverables.outputs.clang_name }}
+ path: ${{ steps.deliverables.outputs.clang_name }}
+ if-no-files-found: error
+
+ - name: Upload lldb artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ steps.deliverables.outputs.lldb_name }}
+ path: ${{ steps.deliverables.outputs.lldb_name }}
+ if-no-files-found: error
+
+ - name: Upload ld artifact
uses: actions/upload-artifact@v4
with:
- name: ${{ steps.package.outputs.debug_pkg_name }}
- path: ${{ steps.package.outputs.debug_pkg_name }}
+ name: ${{ steps.deliverables.outputs.ld_name }}
+ path: ${{ steps.deliverables.outputs.ld_name }}
if-no-files-found: error
- - name: Upload stripped artifact
+ - name: Upload debug symbols artifact
uses: actions/upload-artifact@v4
with:
- name: ${{ env.stripped_pkg_name }}
- path: ${{ env.stripped_pkg_name }}
+ name: debug_symbols.tar.gz
+ path: debug_symbols.tar.gz
if-no-files-found: error
>From a37b22f7e03696a9767d484cceff33547c021371 Mon Sep 17 00:00:00 2001
From: Codex <codex@local>
Date: Thu, 5 Mar 2026 18:13:11 +0800
Subject: [PATCH 05/17] ci: fix alpine static packaging workflow
---
.github/workflows/alpine-static-package.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 783ed801743f7..85859e5d4cdd5 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -95,7 +95,7 @@ jobs:
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
- -DLLVM_USE_STATIC_ZSTD
+ -DLLVM_USE_STATIC_ZSTD=ON
- name: Build
run: |
>From 4315115e65534fcb23f3d220edf9736146777226 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Thu, 19 Mar 2026 13:51:58 +0800
Subject: [PATCH 06/17] ci: keep alpine static package workflow lldb-only
---
.github/workflows/alpine-static-package.yml | 42 +++++++--------------
1 file changed, 13 insertions(+), 29 deletions(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 85859e5d4cdd5..142db6926f3cf 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -10,7 +10,7 @@ permissions:
jobs:
build-and-package:
- name: Build clang/lld/lldb (alpine static)
+ name: Build lldb (alpine static)
runs-on: ubuntu-24.04
container:
image: alpine:3.20
@@ -44,7 +44,11 @@ jobs:
zstd-dev \
xz \
xz-dev \
- zlib-dev
+ zlib-dev \
+ ncurses-dev \
+ ncurses-static \
+ libedit-dev \
+ libedit-static
- name: Checkout source
uses: actions/checkout@v4
@@ -82,14 +86,14 @@ jobs:
-DCMAKE_EXE_LINKER_FLAGS="-static -fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" \
- -DLLVM_ENABLE_PROJECTS="clang;lld;lldb" \
+ -DLLVM_ENABLE_PROJECTS="lldb" \
-DLLVM_ENABLE_LTO="${LTO_MODE}" \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DLLDB_ENABLE_PYTHON=OFF \
- -DLLVM_ENABLE_TERMINFO=OFF \
- -DLLVM_ENABLE_LIBEDIT=OFF \
+ -DLLVM_ENABLE_TERMINFO=ON \
+ -DLLVM_ENABLE_LIBEDIT=ON \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_ZSTD=FORCE_ON \
-DLLVM_INCLUDE_TESTS=OFF \
@@ -100,7 +104,7 @@ jobs:
- name: Build
run: |
set -eux
- ninja -C build clang lld lldb
+ ninja -C build lldb
- name: Show sccache stats
if: always()
@@ -116,8 +120,6 @@ jobs:
- name: Verify static linkage (best effort)
run: |
set -eux
- file package/bin/clang || true
- file package/bin/ld.lld || true
file package/bin/lldb || true
- name: Prepare deliverables
@@ -128,28 +130,17 @@ jobs:
cp -a package package-stripped
mkdir -p debug_symbols
- for bin in clang lldb ld.lld; do
+ for bin in lldb; do
objcopy --only-keep-debug "package/bin/${bin}"
"debug_symbols/${bin}.debug"
strip --strip-debug "package-stripped/bin/${bin}"
done
- cp "package-stripped/bin/clang" "clang-${SHORT_SHA}"
cp "package-stripped/bin/lldb" "lldb-${SHORT_SHA}"
- cp "package-stripped/bin/ld.lld" "ld-${SHORT_SHA}"
- chmod +x "clang-${SHORT_SHA}" "lldb-${SHORT_SHA}" "ld-${SHORT_SHA}"
+ chmod +x "lldb-${SHORT_SHA}"
tar -C debug_symbols -czf debug_symbols.tar.gz .
- echo "clang_name=clang-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
- echo "lldb_name=lldb-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
- echo "ld_name=ld-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
-
- - name: Upload clang artifact
- uses: actions/upload-artifact@v4
- with:
- name: ${{ steps.deliverables.outputs.clang_name }}
- path: ${{ steps.deliverables.outputs.clang_name }}
- if-no-files-found: error
+ echo "lldb_name=lldb-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
- name: Upload lldb artifact
uses: actions/upload-artifact@v4
@@ -158,13 +149,6 @@ jobs:
path: ${{ steps.deliverables.outputs.lldb_name }}
if-no-files-found: error
- - name: Upload ld artifact
- uses: actions/upload-artifact@v4
- with:
- name: ${{ steps.deliverables.outputs.ld_name }}
- path: ${{ steps.deliverables.outputs.ld_name }}
- if-no-files-found: error
-
- name: Upload debug symbols artifact
uses: actions/upload-artifact@v4
with:
>From 1a79122c58a497eb56d6e131d0140dccdb121de9 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Thu, 19 Mar 2026 14:18:39 +0800
Subject: [PATCH 07/17] ci: shallow checkout in alpine static workflow
---
.github/workflows/alpine-static-package.yml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 142db6926f3cf..d19ec0b53b519 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -51,9 +51,12 @@ jobs:
libedit-static
- name: Checkout source
- uses: actions/checkout@v4
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #
v6.0.1
with:
- fetch-depth: 0
+ # This job only needs the checked out commit itself; fetching the
full
+ # branch and tag history adds several minutes on large repositories.
+ fetch-depth: 1
+ fetch-tags: false
- name: Restore sccache cache
uses: actions/cache@v4
>From 55f37b25db526eec33bfa735fa309ecb66493876 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Thu, 19 Mar 2026 14:37:23 +0800
Subject: [PATCH 08/17] ci: update alpine image and reduce llvm build scope
---
.github/workflows/alpine-static-package.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index d19ec0b53b519..78cca97498e17 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -13,7 +13,7 @@ jobs:
name: Build lldb (alpine static)
runs-on: ubuntu-24.04
container:
- image: alpine:3.20
+ image: alpine:3.23
env:
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
CCACHE_BASEDIR: ${{ github.workspace }}/.cache/sccache
@@ -92,7 +92,9 @@ jobs:
-DLLVM_ENABLE_PROJECTS="lldb" \
-DLLVM_ENABLE_LTO="${LTO_MODE}" \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
+ -DLLVM_BUILD_TOOLS=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
+ -DLLVM_TARGETS_TO_BUILD="X86" \
-DBUILD_SHARED_LIBS=OFF \
-DLLDB_ENABLE_PYTHON=OFF \
-DLLVM_ENABLE_TERMINFO=ON \
>From 99d9a903a0fdc93ca01f6b5a9c8858c482fea66d Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Fri, 20 Mar 2026 16:10:19 +0800
Subject: [PATCH 09/17] lldb: support static lib build and enable in alpine
packaging workflow
---
.github/workflows/alpine-static-package.yml | 36 ++++++++++++---------
lldb/source/API/CMakeLists.txt | 35 +++++++++++++++++++-
lldb/source/API/LLDBConfig.cmake.in | 7 ++++
3 files changed, 61 insertions(+), 17 deletions(-)
create mode 100644 lldb/source/API/LLDBConfig.cmake.in
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 78cca97498e17..6ea51fef8f604 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -15,8 +15,9 @@ jobs:
container:
image: alpine:3.23
env:
- SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
- CCACHE_BASEDIR: ${{ github.workspace }}/.cache/sccache
+ CCACHE_DIR: ${{ github.workspace }}/.cache/ccache
+ CCACHE_BASEDIR: ${{ github.workspace }}
+ LLVM_CCACHE_MAXSIZE: 2G
LTO_MODE: Thin
defaults:
run:
@@ -38,7 +39,7 @@ jobs:
ninja \
perl \
python3 \
- sccache \
+ ccache \
swig \
zstd-static \
zstd-dev \
@@ -58,21 +59,21 @@ jobs:
fetch-depth: 1
fetch-tags: false
- - name: Restore sccache cache
+ - name: Restore ccache cache
uses: actions/cache@v4
with:
- path: ${{ env.SCCACHE_DIR }}
- key: sccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-${{
hashFiles('.github/workflows/alpine-static-package.yml') }}
+ path: ${{ env.CCACHE_DIR }}
+ key: ccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-${{
hashFiles('.github/workflows/alpine-static-package.yml') }}
restore-keys: |
- sccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-
- sccache-alpine-static-${{ runner.os }}-
+ ccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-
+ ccache-alpine-static-${{ runner.os }}-
- - name: Initialize sccache
+ - name: Initialize ccache
run: |
set -eux
- mkdir -p "${SCCACHE_DIR}"
- sccache --version
- sccache --zero-stats || true
+ mkdir -p "${CCACHE_DIR}"
+ ccache --version
+ ccache --zero-stats || true
- name: Configure (RelWithDebInfo + LTO + static)
env:
@@ -84,18 +85,21 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
- -DCMAKE_C_COMPILER_LAUNCHER=sccache \
- -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DCMAKE_EXE_LINKER_FLAGS="-static -fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" \
-DLLVM_ENABLE_PROJECTS="lldb" \
-DLLVM_ENABLE_LTO="${LTO_MODE}" \
+ -DLLVM_CCACHE_BUILD=ON \
+ -DLLVM_CCACHE_DIR="${CCACHE_DIR}" \
+ -DLLVM_CCACHE_MAXSIZE="${LLVM_CCACHE_MAXSIZE}" \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
+ -DLLVM_LINK_LLVM_DYLIB=OFF \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DBUILD_SHARED_LIBS=OFF \
+ -DLLDB_BUILD_STATIC=ON \
-DLLDB_ENABLE_PYTHON=OFF \
-DLLVM_ENABLE_TERMINFO=ON \
-DLLVM_ENABLE_LIBEDIT=ON \
@@ -111,11 +115,11 @@ jobs:
set -eux
ninja -C build lldb
- - name: Show sccache stats
+ - name: Show ccache stats
if: always()
run: |
set -eux
- sccache --show-stats || true
+ ccache --show-stats || true
- name: Install
run: |
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index d921e52aa5190..9e59bc1756394 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -33,7 +33,15 @@ add_custom_target(lldb-sbapi-dwarf-enums
DEPENDS ${sb_languages_file})
set_target_properties(lldb-sbapi-dwarf-enums PROPERTIES FOLDER
"LLDB/Tablegenning")
-add_lldb_library(liblldb SHARED ${option_framework}
+option(LLDB_BUILD_STATIC "Build LLDB as a static library" OFF)
+
+if(LLDB_BUILD_STATIC)
+ set(LLDB_LIBRARY_TYPE STATIC)
+else()
+ set(LLDB_LIBRARY_TYPE SHARED)
+endif()
+
+add_lldb_library(liblldb ${LLDB_LIBRARY_TYPE} ${option_framework}
SBAddress.cpp
SBAddressRange.cpp
SBAddressRangeList.cpp
@@ -142,6 +150,31 @@ add_lldb_library(liblldb SHARED ${option_framework}
${option_install_prefix}
)
+install(TARGETS liblldb EXPORT LLDBTargets
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include
+)
+
+include(CMakePackageConfigHelpers)
+set(LLDB_PACKAGE_PATH "lib/cmake/lldb")
+configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/LLDBConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/LLDBConfig.cmake"
+ INSTALL_DESTINATION "${LLDB_PACKAGE_PATH}"
+)
+
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/LLDBConfig.cmake"
+ DESTINATION "${LLDB_PACKAGE_PATH}"
+)
+
+install(
+ EXPORT LLDBTargets
+ DESTINATION "${LLDB_PACKAGE_PATH}"
+)
+
if (LLDB_ENABLE_PYTHON)
add_python_wrapper(liblldb)
endif()
diff --git a/lldb/source/API/LLDBConfig.cmake.in
b/lldb/source/API/LLDBConfig.cmake.in
new file mode 100644
index 0000000000000..beb8625d8d7a9
--- /dev/null
+++ b/lldb/source/API/LLDBConfig.cmake.in
@@ -0,0 +1,7 @@
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+find_dependency(Clang)
+
+include("${CMAKE_CURRENT_LIST_DIR}/LLDBTargets.cmake")
>From 3ef9a34e38905a278d5559d370639a93b8f63dbc Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Fri, 20 Mar 2026 16:19:05 +0800
Subject: [PATCH 10/17] lldb: drop broken LLDBTargets export from API install
---
lldb/source/API/LLDBConfig.cmake.in | 7 -------
1 file changed, 7 deletions(-)
delete mode 100644 lldb/source/API/LLDBConfig.cmake.in
diff --git a/lldb/source/API/LLDBConfig.cmake.in
b/lldb/source/API/LLDBConfig.cmake.in
deleted file mode 100644
index beb8625d8d7a9..0000000000000
--- a/lldb/source/API/LLDBConfig.cmake.in
+++ /dev/null
@@ -1,7 +0,0 @@
-@PACKAGE_INIT@
-
-include(CMakeFindDependencyMacro)
-
-find_dependency(Clang)
-
-include("${CMAKE_CURRENT_LIST_DIR}/LLDBTargets.cmake")
>From 91cc33c0de40f8b97f49a3a44b0d02536f1393f0 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Fri, 20 Mar 2026 16:19:47 +0800
Subject: [PATCH 11/17] lldb: stop exporting LLDBTargets for liblldb install
---
lldb/source/API/CMakeLists.txt | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 9e59bc1756394..5c591f1f96222 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -150,31 +150,13 @@ add_lldb_library(liblldb ${LLDB_LIBRARY_TYPE}
${option_framework}
${option_install_prefix}
)
-install(TARGETS liblldb EXPORT LLDBTargets
+install(TARGETS liblldb
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
-include(CMakePackageConfigHelpers)
-set(LLDB_PACKAGE_PATH "lib/cmake/lldb")
-configure_package_config_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/LLDBConfig.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/LLDBConfig.cmake"
- INSTALL_DESTINATION "${LLDB_PACKAGE_PATH}"
-)
-
-install(
- FILES "${CMAKE_CURRENT_BINARY_DIR}/LLDBConfig.cmake"
- DESTINATION "${LLDB_PACKAGE_PATH}"
-)
-
-install(
- EXPORT LLDBTargets
- DESTINATION "${LLDB_PACKAGE_PATH}"
-)
-
if (LLDB_ENABLE_PYTHON)
add_python_wrapper(liblldb)
endif()
>From 6ffd61caa113601800b14881fb780cb6b8f213c2 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Fri, 20 Mar 2026 16:27:47 +0800
Subject: [PATCH 12/17] ci: enable LLDB LZMA in alpine static workflow
---
.github/workflows/alpine-static-package.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 6ea51fef8f604..430baae11dda2 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -44,6 +44,7 @@ jobs:
zstd-static \
zstd-dev \
xz \
+ xz-static \
xz-dev \
zlib-dev \
ncurses-dev \
@@ -100,6 +101,7 @@ jobs:
-DLLVM_TARGETS_TO_BUILD="X86" \
-DBUILD_SHARED_LIBS=OFF \
-DLLDB_BUILD_STATIC=ON \
+ -DLLDB_ENABLE_LZMA=ON \
-DLLDB_ENABLE_PYTHON=OFF \
-DLLVM_ENABLE_TERMINFO=ON \
-DLLVM_ENABLE_LIBEDIT=ON \
>From 175da15365c3d914463b9023ec5decc83d49dcf0 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Fri, 20 Mar 2026 16:32:36 +0800
Subject: [PATCH 13/17] ci: force static liblzma for LLDB LZMA detection
---
.github/workflows/alpine-static-package.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 430baae11dda2..6ee8473aa13fa 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -102,6 +102,8 @@ jobs:
-DBUILD_SHARED_LIBS=OFF \
-DLLDB_BUILD_STATIC=ON \
-DLLDB_ENABLE_LZMA=ON \
+ -DLIBLZMA_LIBRARY=/usr/lib/liblzma.a \
+ -DLIBLZMA_INCLUDE_DIR=/usr/include \
-DLLDB_ENABLE_PYTHON=OFF \
-DLLVM_ENABLE_TERMINFO=ON \
-DLLVM_ENABLE_LIBEDIT=ON \
>From eb839fb90c274d836626d5d220495c6952781c04 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Fri, 20 Mar 2026 18:35:01 +0800
Subject: [PATCH 14/17] ci: disable curses/libedit in static lldb build
---
.github/workflows/alpine-static-package.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 6ee8473aa13fa..d5f8cd2253052 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -102,11 +102,12 @@ jobs:
-DBUILD_SHARED_LIBS=OFF \
-DLLDB_BUILD_STATIC=ON \
-DLLDB_ENABLE_LZMA=ON \
+ -DLLDB_ENABLE_CURSES=OFF \
+ -DLLDB_ENABLE_LIBEDIT=OFF \
-DLIBLZMA_LIBRARY=/usr/lib/liblzma.a \
-DLIBLZMA_INCLUDE_DIR=/usr/include \
-DLLDB_ENABLE_PYTHON=OFF \
-DLLVM_ENABLE_TERMINFO=ON \
- -DLLVM_ENABLE_LIBEDIT=ON \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_ZSTD=FORCE_ON \
-DLLVM_INCLUDE_TESTS=OFF \
>From 2a8453b80ee4add66adedbf6f186b305483cdd5a Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Mon, 23 Mar 2026 09:22:49 +0800
Subject: [PATCH 15/17] ci: install only lldb component in alpine static
workflow
---
.github/workflows/alpine-static-package.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index d5f8cd2253052..2c0eb1cef959b 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -129,7 +129,7 @@ jobs:
- name: Install
run: |
set -eux
- cmake --install build --prefix "$PWD/package"
+ cmake --install build --prefix "$PWD/package" --component lldb
- name: Verify static linkage (best effort)
run: |
>From 4b82bdc458dab1829841bbf6f454d917db34fe87 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Mon, 23 Mar 2026 11:44:23 +0800
Subject: [PATCH 16/17] ci: fix alpine workflow git safety and ccache save on
failure
---
.github/workflows/alpine-static-package.yml | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index 2c0eb1cef959b..cd724c22e8cdb 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -60,8 +60,14 @@ jobs:
fetch-depth: 1
fetch-tags: false
+ - name: Mark workspace as git safe directory
+ run: |
+ set -eux
+ git config --global --add safe.directory "${GITHUB_WORKSPACE}"
+
- name: Restore ccache cache
- uses: actions/cache@v4
+ id: ccache-cache
+ uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-alpine-static-${{ runner.os }}-${{ env.LTO_MODE }}-${{
hashFiles('.github/workflows/alpine-static-package.yml') }}
@@ -126,6 +132,13 @@ jobs:
set -eux
ccache --show-stats || true
+ - name: Save ccache cache
+ if: always() && !cancelled()
+ uses: actions/cache/save@v4
+ with:
+ path: ${{ env.CCACHE_DIR }}
+ key: ${{ steps.ccache-cache.outputs.cache-primary-key }}
+
- name: Install
run: |
set -eux
>From 5686cf39a257becacbf488168298d53df79e6d51 Mon Sep 17 00:00:00 2001
From: eirikr-zhong <[email protected]>
Date: Mon, 23 Mar 2026 14:18:28 +0800
Subject: [PATCH 17/17] ci: trigger alpine package workflow on main push
---
.github/workflows/alpine-static-package.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/alpine-static-package.yml
b/.github/workflows/alpine-static-package.yml
index cd724c22e8cdb..3c84b344c377c 100644
--- a/.github/workflows/alpine-static-package.yml
+++ b/.github/workflows/alpine-static-package.yml
@@ -1,7 +1,7 @@
name: Alpine Static LLVM Package
on:
- pull_request:
+ push:
branches:
- main
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits