Skip to content

Commit 09de4df

Browse files
committed
Fix static linking
1 parent f4e1c62 commit 09de4df

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

.github/workflows/release.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
if: github.event_name == 'create' && github.event.ref_type == 'tag'
1010
name: Release
1111
runs-on: [self-hosted, linux, x64, kvm]
12+
env:
13+
# Static link host tools so they don't depend on build host's glibc version
14+
HOSTLDFLAGS: "-static -lz"
1215
steps:
1316
- name: Code checkout
1417
uses: actions/checkout@v4
@@ -21,9 +24,7 @@ jobs:
2124
- name: Build (aarch64)
2225
run: ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make Image.gz -j `nproc`
2326
- name: Build kernel modules (aarch64)
24-
# HOSTLDFLAGS=-static makes scripts tools (modpost, etc.) statically linked
25-
# so they don't depend on the build host's glibc version. -lz needed for objtool.
26-
run: ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- HOSTLDFLAGS="-static -lz" make modules -j `nproc`
27+
run: ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make modules -j `nproc`
2728
- name: Package kernel headers (aarch64)
2829
run: |
2930
KVER=$(ARCH=arm64 make -s kernelrelease)
@@ -51,9 +52,7 @@ jobs:
5152
- name: Build kernel (x86-64)
5253
run: CFLAGS="-Wa,-mx86-used-note=no" make bzImage -j `nproc`
5354
- name: Build kernel modules (x86-64)
54-
# HOSTLDFLAGS=-static makes scripts tools (modpost, etc.) statically linked
55-
# so they don't depend on the build host's glibc version. -lz needed for objtool.
56-
run: HOSTLDFLAGS="-static -lz" make modules -j `nproc`
55+
run: make modules -j `nproc`
5756
- name: Package kernel headers (x86-64)
5857
run: |
5958
KVER=$(make -s kernelrelease)
@@ -72,6 +71,28 @@ jobs:
7271
7372
echo "Kernel headers packaged for ${KVER}:"
7473
du -sh kernel-headers-x86_64.tar.gz
74+
- name: Verify tools are statically linked
75+
run: |
76+
echo "Checking that host tools are statically linked..."
77+
FAILED=0
78+
for tool in kernel-headers-x86/scripts/basic/fixdep \
79+
kernel-headers-x86/scripts/mod/modpost \
80+
kernel-headers-x86/tools/objtool/objtool; do
81+
if [ -f "$tool" ]; then
82+
if file "$tool" | grep -q "statically linked"; then
83+
echo "✓ $tool: statically linked"
84+
else
85+
echo "✗ $tool: DYNAMICALLY LINKED - this will cause glibc compatibility issues!"
86+
file "$tool"
87+
FAILED=1
88+
fi
89+
fi
90+
done
91+
if [ $FAILED -eq 1 ]; then
92+
echo "ERROR: Some tools are dynamically linked. Check HOSTLDFLAGS setting."
93+
exit 1
94+
fi
95+
echo "All tools verified as statically linked."
7596
- name: Create release
7697
id: create_release
7798
uses: actions/create-release@v1

0 commit comments

Comments
 (0)