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

zig build system #719

Merged
merged 172 commits into from
Oct 8, 2024
Merged

zig build system #719

merged 172 commits into from
Oct 8, 2024

Conversation

ripperi
Copy link
Contributor

@ripperi ripperi commented Sep 24, 2024

No description provided.

@ripperi ripperi force-pushed the ripa/zig branch 2 times, most recently from a7043c0 to 7f75659 Compare October 2, 2024 13:03
@ripperi ripperi force-pushed the ripa/zig branch 2 times, most recently from 3877b73 to bb8bdd8 Compare October 3, 2024 15:14
@pkova
Copy link
Collaborator

pkova commented Oct 8, 2024

Some context here for future travellers:

This PR is a complete rewrite of the build system for vere, switching from Bazel to the Zig build system. We get the following benefits from doing this:

  1. The ability to compile vere on any target will have exactly one dependency, Zig. We do not need libtool, autoconf-archive, Xcode cli, or even git to compile vere anymore.
  2. Cross-compilation support for any target we support from any other target. To compile binaries for aarch64-macos, x86_64-macos, aarch64-linux and x86_64-linux you simply run zig build -Dall.
  3. The zig c compiler wraps clang with some reasonable defaults. One of them is the undefined behavior sanitizer turned on by default in debug builds. This resulted in us finding and fixing many of them, see misc: fix tons of undefined behavior #720 and misc: fix tons of undefined behavior vol 2 #723.
  4. We upgrade clang from 15 -> 18. Note that zig build uses clang internally so now we compile our linux binaries using clang instead of gcc.
  5. Get rid of Bazel.

When trawling through the build some interesting discoveries were made. One of them was that GMP was built without assembly on macos-aarch64:

"@//:macos_aarch64": ["--disable-assembly"],

There are also other miscellaneous quality of life improvements such as not "compiling" the ivory pill with xxd but just checking in the C file which saves around 70 seconds on my mac m2.

The new build process is installing zig 0.13 and typing zig build. A list of build-time options can be displayed with zig build -h. Building a release binary with optimizations is done with zig build -Doptimize=ReleaseFast. Cross-compiling all supported targets is done with zig build -Dall.

pkova and others added 3 commits October 8, 2024 18:26
Looks like I made some kind of rebase snafu on #720. Today I learned
that if you force push something to a PR that results in 0 commits to
the base branch github will just close the PR and disallow any further
pushes to the branch!

Ok let's try this one then.
@pkova pkova merged commit e101ff4 into develop Oct 8, 2024
2 checks passed
@pkova pkova deleted the ripa/zig branch October 8, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants