[WIP] Zig 0.14
Testing the changes
- I tested the changes in this PR: YES
Cross build failures apparently related to https://github.com/ziglang/zig/issues/22704
This is what changed: https://github.com/ziglang/zig/blob/master/src/main.zig#L3997-L4008 https://github.com/ziglang/zig/commit/e567abb339e1edaf5a3c86fe632522a3b8005275
hey @tranzystorekk, I've spent some time digging into zig's source code. It seems like this patch should do it. At least now I can compile waylock for my x86_64 and cross-compile it for aarch64 with no issues.
The way zig works with sysroot and search-prefix is a bit convoluted.
I'm not sure if it's gonna make the whole PR green but I think it should work.
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
index 5c334b1e1e5..91acd23a9fd 100644
--- a/common/build-style/zig-build.sh
+++ b/common/build-style/zig-build.sh
@@ -31,7 +31,7 @@ do_build() {
DESTDIR="zig-out" zig build \
-j"${XBPS_MAKEJOBS}" \
--sysroot "${XBPS_CROSS_BASE}" \
- --search-prefix "${XBPS_CROSS_BASE}/usr" \
+ --search-prefix "/" \
--prefix /usr \
--global-cache-dir /host/zig \
--libc xbps_zig_libc.txt \
hey @tranzystorekk, it seems like all the packages compiling with no issues (including river wm). Is there any other packages you're thinking of? Let me know if I can help with any.
Otherwise let's merge :rocket:
zf and ghostty are still pending a zig0.14 release
On (native) aarch64, during do_build of zig, I get
ninja: error: '/usr/aarch64-linux-gnu/usr/lib/libz3.so', needed by 'zig2', missing and no known rule to make it
Native aarch64 (glibc, 16k page size, on apple silicon) is now able to build zig from this pr:
[18/19] Linking CXX executable zig2
[19/19] Building stage3
and then successfully use it to build river.
any progress?
Zig 0.14.x is affected by https://github.com/ziglang/zig/issues/23978. I'll be testing the upcoming 0.15 release, but that also depends on us packaging LLVM 20, so a bit more work still.
@tranzystorekk
if you compile with export CMAKE_GENERATOR="Unix Makefiles" you'll see there is a "Segmentation fault (core dumped)" message at stage3 but I dunno how to get additional info.
Zig 0.14.x is affected by ziglang/zig#23978. I'll be testing the upcoming 0.15 release, but that also depends on us packaging LLVM 20, so a bit more work still.
I just created PR #57060, which would provide LLVM 20.
Unfortunately my PR for LLVM 20 got dismissed, without someone really looking at the content. 😢
So, I went back to Zig 0.14.1 and tried to apply the result from ziglang/zig#23978 as a patch for LLVM 19. This way I got it compiling natively on all relevant architectures (x86_64, x86_64-musl, aarch64 and aarch64-musl).
I have also tested (cross-)compiling all updated packages from this PR and they work fine. However there some other packages in the repos:
- ghostty: 1.2.0 is a Zig 0.14 release, but it only compiles natively on x86_64. Musl C-library and cross compilation has various issues. I might look into this later again.
- zf: Seems to have released version 0.10.3 for Zig 0.15 directly
- zelbar: No Zig 0.14 release.
- river-bedload: Released version 0.2.0 for Zig 0.15 directly.
So, if someone would get ghostty working, it would be as good as it can get with Zig 0.14. A combined branch of the patch and the changes of this PR is here.
LLVM-21 merged now, and Zig-0.15.2 tagged last month, maybe it's time to resume the work?
Zig has strict dependency on specific major llvm versions, and Zig 0.15 depends on llvm20, so it's not trivial to update at this moment.
Zig has strict dependency on specific major llvm versions, and Zig 0.15 depends on llvm20, so it's not trivial to update at this moment.
Apparently we went from llvm19 straight to llvm21, skipping 20 entirely. But the next release of zig (so 0.16?) should depend on llvm21. At least that's what zig's master branch is built against currently. And it looks like it's coming soon too: https://github.com/ziglang/zig/milestone/30