Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Zig to 0.11.0 #45424

Closed
booniepepper opened this issue Aug 4, 2023 · 24 comments
Closed

Updating Zig to 0.11.0 #45424

booniepepper opened this issue Aug 4, 2023 · 24 comments
Labels

Comments

@booniepepper
Copy link
Contributor

Opening this issue to discuss an upgrade of Zig from 0.10.1 to 0.11.0

Zig 0.11.0 was released yesterday: https://ziglang.org/download/0.11.0/release-notes.html

It's backwards-incompatible with 0.10.1 which should be no big surprise. What I'm
interested in talking about is how to handle the transition. A lot of Zig software
has been tracking the changes for 0.11.0 in particular because it came with some
package management abilities that really made owning a zig-built library or executable
a lot cheaper.

Is it acceptable to have two versions of Zig in void-packages while projects are transitioning?

@booniepepper
Copy link
Contributor Author

cc @ifreund

@icp1994
Copy link
Contributor

icp1994 commented Aug 4, 2023

For a start, it requires llvm v16.x which will take a non-trivial amount of effort to get into Void repos. It's highly likely that by the time the latest llvm hits the repos, the existing zig packages would have already migrated to zig v0.11.x

@booniepepper
Copy link
Contributor Author

That makes sense to me, thanks!

@voidbert
Copy link
Contributor

@icp1994 Are there any plans to package LLVM 16? Packaging something as massive as LLVM is a massive endeavor (see #40821, for LLVM 15), and involves updating many packages that depend on LLVM (Zig, for example). With LLVM 17 just around the corner in September (https://llvm.org/), is it worth it to make an effort, or should Void just skip v16 and go straight to 17?

@icp1994
Copy link
Contributor

icp1994 commented Aug 13, 2023

Honestly, I don't know what the best strategy is. If you are asking for zig only, iirc each major version of zig is compatible with only one major version of llvm so I think if you skip llvm v16 you cannot build zig v0.11.x. But I feel only zig (and related softwares) being blocked on it might not cut for the effort of a llvm update. For example, the last time llvm was updated, rust was also blocked on it.

@voidbert
Copy link
Contributor

@icp1994 The best strategy would be for the folks at LLVM to make their software backwards / forwards compatible, but we all know that's not gonna happen. Nevertheless, Zig will be coming out with some alternative backends (C, x86, ARM and LLVM bitcode, instead of linking to LLVM libraries). This would remove the mandatory LLVM dependency, making a zig update just a version bump + new checksum.

@booniepepper
Copy link
Contributor Author

For what it's worth, in Nix the strategy is to import multiple versions of these foundational things like LLVM. They also do it with Zig since they have software that needs Zig 0.9, 0.10, and now 0.11. Applications and tools and etc tend to only have a single rolling version

@voidbert
Copy link
Contributor

@booniepepper Void already maintains different versions of packages like LLVM (https://github.com/void-linux/void-packages/tree/master/srcpkgs/llvm12, for example). The problem is that there aren't enough human resources to package and maintain all versions of LLVM. Between 12 and 15, there are no other LLVM versions on the repos, for example.

@booniepepper
Copy link
Contributor Author

Looking at the patches and script... Yeah I see how that can be an adventure to set up

@tranzystorekk
Copy link
Contributor

Void already maintains different versions of packages like LLVM

To be precise, we keep the previous llvm version for its libllvm shlib, but all the other subpackages like clang have always had just one version at a time.

@Anachron
Copy link
Contributor

I hope we will find some volunteers to tackle this task.
While I am not skilled enough to do this myself, I would volunteer for testing.

@voidbert
Copy link
Contributor

For anyone here that needs Zig 0.11, even if it doesn't get added to Void's repos, you don't need to build it from source. Zig's prebuilt binaries are statically linked, working perfectly on both musl and glibc systems (I tested it myself).

@booniepepper
Copy link
Contributor Author

Hmmm maybe that's the thing to do. I was also considering packaging my zig-built projects from binaries too, but I didn't know if that would be frowned upon

@Anachron
Copy link
Contributor

Sadly binary releases are nearly impossible to get into Void Packages, but there could maybe be an exception as long as we dont have LLVM16 yet?

Copy link

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.

@github-actions github-actions bot added the Stale label Jan 10, 2024
@booniepepper
Copy link
Contributor Author

I'm still interested in this, but between job hunting and holidays I haven't been able to make the time yet.

IDK if this helps a lot of people, but one note for Zig project owners is that it's possible to support a range of Zig versions even with the breaking changes. Here's an example of me adding Zig 0.10.1 support back into a project that was already upgraded to 0.11.0: so-dang-cool/dt@f58602c

@github-actions github-actions bot removed the Stale label Jan 11, 2024
@icp1994
Copy link
Contributor

icp1994 commented Feb 9, 2024

Now that llvm17 is merged, you can start working on zig-0.11 if you want.

@tranzystorekk
Copy link
Contributor

zig unfortunately pins LLVM version strictly, and 0.11 wants LLVM 16

@icp1994
Copy link
Contributor

icp1994 commented Feb 9, 2024

Ah right, forgot it's not forward compatible either.

@Anachron
Copy link
Contributor

So we have to wait for zig0.12 and hope it uses llvm17? What if it uses 18? This is ridiculous (not our fault though).

Maybe zig has their own Compiler until then.

@voidbert
Copy link
Contributor

So we have to wait for zig0.12 and hope it uses llvm17? What if it uses 18? This is ridiculous (not our fault though).

Maybe zig has their own Compiler until then.

Currently, C, x86 and ARM backups are on the works. Zig is also removing the hard dependency from LLVM: it'll output IR which can then be compiled by LLVM, and it won't need libllvm anymore. I do not know, however, if the produced IR will require a specific LLVM version.

@Calandracas606
Copy link

I'm already working on llvm18 #48661

Hopefully it will ready for zig0.12

@Anachron
Copy link
Contributor

Normally it takes a lot of time until all packages are ready and then zig0.12 will probably be old again.

Copy link

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.

@github-actions github-actions bot added the Stale label May 13, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants