Open
Description
Currently releases and nightly builds on ziglang.org/download are compiled with ReleaseFast
. This has two complications:
- When we encounter compiler bugs, we need to rebuild Zig with debug symbols and (try to) reproduce the issue again.
ReleaseFast
skips assertions. We may not know we hit a compiler bug that until long after compiling.
Users who want to build programs of others' should use the last-published version: that's fast and small. Users who are picking the nightlies know are coming for a ride; we can make that ride a wee bit safer for them. Therefore I suggest:
- Compiled the nightlies (the ones that end up in https://ziglang.org/download) with
-OReleaseSafe
and do not strip. - The point releases should remain as-is --
-OReleaseFast -Dstrip
.
Some immediate benefits and next steps:
- We would have stack traces for each repro of zig prereq races as of 0.11.0-dev.1782+b52be973d #14815 instead of
error: FileNotFound
. - In macos-aarch64: segfault when running a CGo binary #14923: the binary would not have been created in the first place, since there was a good assertion. Since assertion was skipped, the binary was created and then segfaulted.
- I am planning to propose a CI runner that uses
zig cc
as the C compiler to the Go team (pending last issue runtime/pprof: missing profile info for CGo code when compiled with CC="zig cc" golang/go#59466). We will quite certainly want them to run a debug build -- so the back-and-forth reporting can be much quicker due to stack traces and assertions. - If performance change is acceptably low, I would propose to use such build at my employer for all our C/C++ builds.
Depends on #15192
File Size impact
I compiled 0.11.0-dev.2257+f99b75360
(the version of today's zig-bootstrap) with the following flags:
baseline
: what we have today, exceptxz -9e
(I think currently we use-6
). All archives below use this level.safe-strip
:-OReleaseSafe -Dstrip
.safe-debug
:-OReleaseSafe
. This is the one I propose for nightlies.safe-zdebug
:-OReleaseSafe --compress-debug-sections=zlib
.
For linux-x86_64 build the archive increases from 38M to 51M.
$ ls -hsS1 zig-x86_64-linux-musl-baseline-*/bin/zig *.tar.xz | tac
38M zig-x86_64-linux-musl-baseline-baseline.tar.xz
39M zig-x86_64-linux-musl-baseline-safe-strip.tar.xz
51M zig-x86_64-linux-musl-baseline-safe-debug.tar.xz
55M zig-x86_64-linux-musl-baseline-safe-zdebug.tar.xz
132M zig-x86_64-linux-musl-baseline-safe-strip/bin/zig
133M zig-x86_64-linux-musl-baseline-baseline/bin/zig
174M zig-x86_64-linux-musl-baseline-safe-zdebug/bin/zig
222M zig-x86_64-linux-musl-baseline-safe-debug/bin/zig