Correct workflow for stage3 and stage 4 building, testing and debugging

Hi guys,

I’m currently a PhD student who has a focus on formal verification and is interested in Zig. I’m digging into the Zig codegen aarch64 codebase since some days (I’m heavily in interested in arm64 especially Android low level stuff).
I want to contribute and try to fix some low hanging fruits to get a better overview of Zig as a whole.

I started by investigating where the codegen for aarch64 without llvm currently stops working (by running the test suite).

For testing, I used: build/stage4/bin/zig test test/behavior.zig -target aarch64-linux -fno-llvm -fno-lld --test-cmd qemu-aarch64-static --test-cmd-bin -j1 (please tell me if this is stupid, I use -j1 to run the threads in a single thread env, so I get my print calls).
I get a crash at an assert in Select.zig in aarch64 (so far so good).

I want to ask now multiple things.

  1. Upon a change that will fix something I will rebuild the strage4 with stage3 by running:
    stage3/bin/zig build -p stage4 -Dno-lib -Doptimize=Debug -j10 The problem is, this takes a while (~3 minutes, I have a quite good setup but still). Is this correct, or am I missing something?
  2. I experimented with -Doptimize=Debug --watch -fincremental but when I get a crash there are no debug symbols to backtrack on. (Even there are symbols in there checked with file), is this intended or am I missing here something?
  3. Is my way of running the test correct or complete nonsense?

Thank you very much.

Malte

I haven’t done this, but I’m interested in learning as well. If you want a faster answer, I’d suggest chatting in the Zulip.

My guess, though, is that you shouldn’t need to do this? Once you have a master build of zig, you can just zig build in the root of your source tree to have that copy of zig build itself, run the tests, and so on.

This post is now a little old, but might still hold up. However, building like this, as @alanza indicates, is normally valuable to those working on making changes to, e.g., std code (you mention stage3 → stage4 specifically). If that’s what you’re doing, this might be a start. If not, indeed, you may be barking up a needless tree.