void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

[WIP] Zig 0.14

Open tranzystorekk opened this issue 9 months ago • 7 comments

Testing the changes

  • I tested the changes in this PR: YES

tranzystorekk avatar Mar 10 '25 17:03 tranzystorekk

Cross build failures apparently related to https://github.com/ziglang/zig/issues/22704

tranzystorekk avatar Mar 10 '25 19:03 tranzystorekk

This is what changed: https://github.com/ziglang/zig/blob/master/src/main.zig#L3997-L4008 https://github.com/ziglang/zig/commit/e567abb339e1edaf5a3c86fe632522a3b8005275

oreo639 avatar Apr 01 '25 22:04 oreo639

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 \

krydos avatar Apr 25 '25 05:04 krydos

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:

krydos avatar Apr 30 '25 08:04 krydos

zf and ghostty are still pending a zig0.14 release

tranzystorekk avatar Apr 30 '25 09:04 tranzystorekk

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

dkwo avatar May 07 '25 22:05 dkwo

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.

dkwo avatar Jun 17 '25 13:06 dkwo

any progress?

LightSrc avatar Aug 06 '25 11:08 LightSrc

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 avatar Aug 06 '25 13:08 tranzystorekk

@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.

MIvanchev avatar Aug 24 '25 09:08 MIvanchev

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.

moabeat-berlin avatar Sep 09 '25 06:09 moabeat-berlin

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.

moabeat-berlin avatar Oct 04 '25 05:10 moabeat-berlin

LLVM-21 merged now, and Zig-0.15.2 tagged last month, maybe it's time to resume the work?

Vinfall avatar Nov 08 '25 03:11 Vinfall

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.

tranzystorekk avatar Nov 08 '25 14:11 tranzystorekk

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

al20ov avatar Nov 20 '25 12:11 al20ov