Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit fafdd5a

Browse files
Build musl from source
Required to patch recent CVE. Once a package is updated, this can be switched to a standard package install.
1 parent 960ea24 commit fafdd5a

File tree

1 file changed

+51
-7
lines changed

1 file changed

+51
-7
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,37 @@ jobs:
8989
NODE_VERSION: '20.x'
9090
FORCE_COLOR: '1'
9191
steps:
92+
- name: Checkout musl
93+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
94+
with:
95+
repository: kraj/musl
96+
ref: c47ad25ea3b484e10326f933e927c0bc8cded3da # patched 1.2.5 version
97+
path: musl
9298
- name: Install musl
9399
run: |
94-
sudo apt-get install -y musl
95-
sudo ld-musl-config
100+
# See https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/
101+
export MUSL_HOME=$PWD/musl-toolchain
102+
103+
# Build musl from source
104+
pushd musl
105+
./configure --prefix=$MUSL_HOME --static
106+
sudo make && make install
107+
popd
108+
96109
# Install a symlink for use by native-image
97-
sudo ln -s $MUSL_HOME/bin/musl-gcc $MUSL_HOME/bin/x86_64-linux-musl-gcc
110+
ln -s $MUSL_HOME/bin/musl-gcc $MUSL_HOME/bin/x86_64-linux-musl-gcc
111+
98112
# Extend the system path and confirm that musl is available by printing its version
99113
export PATH="$MUSL_HOME/bin:$PATH"
100114
x86_64-linux-musl-gcc --version
115+
116+
# Build zlib with musl from source and install into the MUSL_HOME directory
117+
curl -O https://zlib.net/fossils/zlib-1.2.13.tar.gz
118+
tar -xzvf zlib-1.2.13.tar.gz
119+
pushd zlib-1.2.13
120+
CC=musl-gcc ./configure --prefix=$MUSL_HOME --static
121+
make && make install
122+
popd
101123
- name: Setup Java
102124
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
103125
with:
@@ -169,15 +191,37 @@ jobs:
169191
NODE_VERSION: '20.x'
170192
FORCE_COLOR: '1'
171193
steps:
194+
- name: Checkout musl
195+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
196+
with:
197+
repository: kraj/musl
198+
ref: c47ad25ea3b484e10326f933e927c0bc8cded3da # patched 1.2.5 version
199+
path: musl
172200
- name: Install musl
173201
run: |
174-
sudo apt-get install -y musl
175-
sudo ld-musl-config
202+
# See https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/
203+
export MUSL_HOME=$PWD/musl-toolchain
204+
205+
# Build musl from source
206+
pushd musl
207+
./configure --prefix=$MUSL_HOME --static
208+
sudo make && make install
209+
popd
210+
176211
# Install a symlink for use by native-image
177-
sudo ln -s $MUSL_HOME/bin/musl-gcc $MUSL_HOME/bin/x86_64-linux-musl-gcc
212+
ln -s $MUSL_HOME/bin/musl-gcc $MUSL_HOME/bin/arm64-linux-musl-gcc
213+
178214
# Extend the system path and confirm that musl is available by printing its version
179215
export PATH="$MUSL_HOME/bin:$PATH"
180-
x86_64-linux-musl-gcc --version
216+
arm64-linux-musl-gcc --version
217+
218+
# Build zlib with musl from source and install into the MUSL_HOME directory
219+
curl -O https://zlib.net/fossils/zlib-1.2.13.tar.gz
220+
tar -xzvf zlib-1.2.13.tar.gz
221+
pushd zlib-1.2.13
222+
CC=musl-gcc ./configure --prefix=$MUSL_HOME --static
223+
make && make install
224+
popd
181225
- name: Setup Java
182226
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
183227
with:

0 commit comments

Comments
 (0)