Skip to content

Proposal: change nightlies from ReleaseFast to ReleaseSafe+debug #15194

Open
@motiejus

Description

@motiejus

Currently releases and nightly builds on ziglang.org/download are compiled with ReleaseFast. This has two complications:

  1. When we encounter compiler bugs, we need to rebuild Zig with debug symbols and (try to) reproduce the issue again.
  2. 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:

  1. Compiled the nightlies (the ones that end up in https://ziglang.org/download) with -OReleaseSafe and do not strip.
  2. The point releases should remain as-is -- -OReleaseFast -Dstrip.

Some immediate benefits and next steps:

  1. 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.
  2. 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.
  3. 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.
  4. 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:

  1. baseline: what we have today, except xz -9e (I think currently we use -6). All archives below use this level.
  2. safe-strip: -OReleaseSafe -Dstrip.
  3. safe-debug: -OReleaseSafe. This is the one I propose for nightlies.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions