Skip to content

Commit 88b2ba7

Browse files
committed
fix(ci): do not use zig as linker, only as C/C++ compiler
Zig's linker provides its own musl CRT startup objects (_start, _start_c) which conflict with Rust's self-contained musl CRT objects. Only use zig for compiling C/C++ source (z3, ring); the system gcc works correctly as the linker since Rust supplies its own musl sysroot.
1 parent d450885 commit 88b2ba7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/release-dev.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,13 @@ jobs:
227227
chmod +x "/tmp/zig-musl/${tool}"
228228
done
229229
230-
# Tell cargo / cc-rs / cmake to use zig for the musl target
230+
# Tell cargo / cc-rs / cmake to use zig for C/C++ compilation.
231+
# Do NOT set the linker — Rust's default linker (system cc/gcc)
232+
# works correctly because Rust ships its own musl CRT objects.
233+
# Using zig as the linker causes duplicate _start symbols.
231234
TARGET_ENV=$(echo "${{ matrix.target }}" | tr '-' '_')
232235
echo "CC_${TARGET_ENV}=/tmp/zig-musl/cc" >> "$GITHUB_ENV"
233236
echo "CXX_${TARGET_ENV}=/tmp/zig-musl/c++" >> "$GITHUB_ENV"
234-
echo "CARGO_TARGET_${TARGET_ENV^^}_LINKER=/tmp/zig-musl/cc" >> "$GITHUB_ENV"
235237
236238
- name: Scope workspace to CLI crates
237239
run: |

.github/workflows/release-tag.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,13 @@ jobs:
249249
chmod +x "/tmp/zig-musl/${tool}"
250250
done
251251
252-
# Tell cargo / cc-rs / cmake to use zig for the musl target
252+
# Tell cargo / cc-rs / cmake to use zig for C/C++ compilation.
253+
# Do NOT set the linker — Rust's default linker (system cc/gcc)
254+
# works correctly because Rust ships its own musl CRT objects.
255+
# Using zig as the linker causes duplicate _start symbols.
253256
TARGET_ENV=$(echo "${{ matrix.target }}" | tr '-' '_')
254257
echo "CC_${TARGET_ENV}=/tmp/zig-musl/cc" >> "$GITHUB_ENV"
255258
echo "CXX_${TARGET_ENV}=/tmp/zig-musl/c++" >> "$GITHUB_ENV"
256-
echo "CARGO_TARGET_${TARGET_ENV^^}_LINKER=/tmp/zig-musl/cc" >> "$GITHUB_ENV"
257259
258260
- name: Scope workspace to CLI crates
259261
run: |

0 commit comments

Comments
 (0)