Skip to content

Commit b7e38d4

Browse files
committed
fix(ci): simplify musl-g++ wrapper to only disable FORTIFY_SOURCE
The musl-gcc.specs approach strips all system include paths via -nostdinc, which removes C++ standard library headers and breaks std::atomic detection in z3's cmake build. Simpler approach: the only glibc-specific symbols z3 was pulling in were __printf_chk and similar __*_chk functions generated by _FORTIFY_SOURCE hardening. Disabling _FORTIFY_SOURCE makes g++ emit standard printf/memcpy/etc. calls that musl provides, while keeping all C++ headers intact.
1 parent f91cdb7 commit b7e38d4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/release-dev.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,13 @@ jobs:
206206
run: |
207207
set -euo pipefail
208208
# musl-tools ships musl-gcc (C wrapper) but not a C++ equivalent.
209-
# z3's bundled cmake build needs a C++ compiler that targets musl.
210-
# Extract the specs path from musl-gcc and create a parallel g++ wrapper.
211-
SPECS=$(sed -n 's/.*-specs "\([^"]*\)".*/\1/p' "$(which musl-gcc)")
212-
printf '#!/bin/sh\nexec g++ "$@" -specs "%s"\n' "$SPECS" > /usr/local/bin/musl-g++
209+
# z3's cmake build needs a C++ compiler for the musl target.
210+
# Using the musl-gcc.specs with g++ breaks C++ headers (-nostdinc
211+
# strips them). Instead, disable _FORTIFY_SOURCE which is the only
212+
# source of glibc-specific symbols (__printf_chk, __memcpy_chk, etc.)
213+
# that musl doesn't provide. Standard C/C++ symbols are fine — musl
214+
# implements them all.
215+
printf '#!/bin/sh\nexec g++ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 "$@"\n' > /usr/local/bin/musl-g++
213216
chmod +x /usr/local/bin/musl-g++
214217
215218
- name: Add Rust musl target

.github/workflows/release-tag.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ jobs:
227227
- name: Create musl-g++ wrapper
228228
run: |
229229
set -euo pipefail
230-
SPECS=$(sed -n 's/.*-specs "\([^"]*\)".*/\1/p' "$(which musl-gcc)")
231-
printf '#!/bin/sh\nexec g++ "$@" -specs "%s"\n' "$SPECS" > /usr/local/bin/musl-g++
230+
printf '#!/bin/sh\nexec g++ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 "$@"\n' > /usr/local/bin/musl-g++
232231
chmod +x /usr/local/bin/musl-g++
233232
234233
- name: Add Rust musl target

0 commit comments

Comments
 (0)