I was refactoring a substantial portion of the code. I don’t use watch to catch compilation errors during development - especially since I wouldn’t want to see a flood of errors while the code is still incomplete. So, after several days of work, I finally finished this part and was ready to build the project, expecting the compiler to show me any remaining errors so I could fix them.
But instead of error messages, I just got a generic failure notification for a specific build step… I spent two hours experimenting with various compiler flags, but nothing helped - there were absolutely no clues.
Then I switched to Windows and tried building there as well, only to get the same result - though this time I did get an error code: 5! Honestly, that didn’t help me pinpoint the issue at all.
Back on Linux, I tried switching from version 0.15.2 to the master branch. During the rebuild, I encountered a few errors in other modules (since I haven’t fully ported everything to the new I/O yet). However, the problematic module (the one that previously failed to compile entirely), this time, caused the compiler to hang during semantic analysis. Oddly, the file where the hang occurred hadn’t been modified in half a year and doesn’t reference any of my new code at all. It was a complete dead end.
I interrupted the build and restarted it - and got the exact same problem again:
qemu
└─ run qemu-system-x86_64
└─ install generated to bamos.iso
└─ run mkbootimg (bamos.iso)
└─ install bamos.elf
└─ compile exe bamos.elf ReleaseSafe x86_64-freestanding
└─ compile obj bamos ReleaseSafe x86_64-freestanding failure
error: process terminated unexpectedly
failed command: /home/whkostya/.local/share/zigup/0.16.0-dev.1484+d0ba6642b/files/zig build-obj -fllvm -ofmt=elf -fno-omit-frame-pointer -fno-error-tracing -fPIC -OReleaseSafe -mcmodel kernel -target x86_64-freestanding -mcpu baseline -I /home/whkostya/assembly/bamos-zig/third-party/boot --dep dbg-info -Mroot=/home/whkostya/assembly/bamos-zig/src/kernel/main.zig -fstrip -mno-red-zone -OReleaseSafe -target x86_64-freestanding -mcpu baseline -Mdbg-info=/home/whkostya/assembly/bamos-zig/build-tools/dbg-make/dbg.zig --cache-dir .zig-cache --global-cache-dir /home/whkostya/.cache/zig --name bamos --zig-lib-dir /home/whkostya/.local/share/zigup/0.16.0-dev.1484+d0ba6642b/files/lib/ --listen=-
Build Summary: 4/16 steps succeeded (3 failed)
qemu transitive failure
└─ run qemu-system-x86_64 transitive failure
├─ run mkbootimg (bamos.iso) transitive failure
│ ├─ run exe zip (mkbootimg) transitive failure
│ │ └─ compile exe zip ReleaseFast native 1 errors
│ ├─ compile exe bamos.elf ReleaseSafe x86_64-freestanding transitive failure
│ │ ├─ compile obj bamos ReleaseSafe x86_64-freestanding failure
│ │ ├─ compile obj dbg-script ReleaseSafe x86_64-freestanding transitive failure
│ │ │ └─ run exe dbg-make (debug.sym) transitive failure
│ │ │ ├─ compile exe dbg-make ReleaseFast native 1 errors
│ │ │ └─ compile obj bamos ReleaseSafe x86_64-freestanding (reused)
│ │ ├─ compile obj bamos ReleaseSafe x86_64-freestanding (reused)
│ │ └─ compile obj dbg-script ReleaseSafe x86_64-freestanding (+1 more reused dependencies)
│ └─ install bamos.elf transitive failure
│ └─ compile exe bamos.elf ReleaseSafe x86_64-freestanding (+6 more reused dependencies)
└─ install generated to bamos.iso transitive failure
└─ run mkbootimg (bamos.iso) (+4 more reused dependencies)
error: the following build command failed with exit code 1:
.zig-cache/o/435f97f5ef3e9347a2922a94fc55fe8e/build /home/whkostya/.local/share/zigup/0.16.0-dev.1484+d0ba6642b/files/zig /home/whkostya/.local/share/zigup/0.16.0-dev.1484+d0ba6642b/files/lib /home/whkostya/assembly/bamos-zig .zig-cache /home/whkostya/.cache/zig --seed 0x67e9a2e7 -Z1a476aaf79b21061 qemu --release=safe -Dqemu-drives=nvme.img
Additional details:
- The LLVM backend is being used (the code contains many inline assembly blocks, and the new backend produces numerous syntax errors).
- The issue occurs regardless of build mode (ReleaseSafe, ReleaseFast, Debug).
- The problem occurs on both Windows and Linux hosts.
If anyone has a Zig compiler built with the --debug* options enabled, please let me know. I’d really prefer not to spend time building Zig from source myself (LLVM is really huge).