ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
34.27k stars 2.5k forks source link

Latest master tarball is unable to build a stage4 zig #20109

Closed theoparis closed 4 months ago

theoparis commented 4 months ago

Zig Version

0.13.0-dev.274+c0da92f71

Steps to Reproduce and Observed Behavior

I've gotten errors such as

getPath() was called on a GeneratedFile that wasn't built yet.
  source package path: /home/theo/Documents/zig
  Is there a missing Step dependency on step 'zig build-exe zig Debug x86_64-windows-gnu'?
    The step was created by this stack trace:
name: 'zig build-exe zig Debug x86_64-windows-gnu'. creation stack trace:
/home/theo/Documents/zig/lib/std/Build/Step/Compile.zig:365:26: 0x11e1f14 in create (build)
        .step = Step.init(.{
                         ^
/home/theo/Documents/zig/lib/std/Build.zig:669:31: 0x1190156 in addExecutable (build)
    return Step.Compile.create(b, .{
                              ^
/home/theo/Documents/zig/build.zig:616:32: 0x1188199 in addCompilerStep (build)
    const exe = b.addExecutable(.{
                               ^
/home/theo/Documents/zig/build.zig:182:32: 0x118ada5 in build (build)
    const exe = addCompilerStep(b, .{

Or this: (I have plenty of available RAM) image

Or this:

└─ zig build-exe zig Debug x86_64-windows-g
thread 124192 panic: attempt to use null value
/home/theo/Documents/zig/lib/std/Build/Step/Compile.zig:1732:60: 0x1238276 in make (build)
        const output_dir = fs.path.dirname(output_bin_path).?;
                                                           ^
/home/theo/Documents/zig/lib/std/Build/Step.zig:182:13: 0x1206287 in make (build)
    s.makeFn(s, prog_node) catch |err| switch (err) {
            ^

Example command I used for x86_64-windows-gnu:

~/zig/zig build --zig-lib-dir lib -Dtarget=x86_64-windows-gnu -p zig-out/x86_64-windows-gnu -Dno-langref=true

where ~/zig/zig is downloaded from ziglang.org/download.

Expected Behavior

A successfully built zig compiler in zig-out/x86_64-windows-gnu/bin/zig.

theoparis commented 4 months ago

Additionally, using bootstrap.c seems to work fine. However in that case the x86 backend has its own issues when trying to cross compile for x86_64-windows-gnu.

mlugg commented 4 months ago

The binary API used to communicate between the compiler and the build runner changed in the recent std.Progress rewrite in a backwards-incompatible manner. This change hasn't hit the downloadable tarballs yet; as such, you'll have to either wait for the tarballs to update, or run a full CMake bootstrap.

(It's unfortunate that this causes nonsense errors; we should probably have some kind of version check in the protocol.)

theoparis commented 4 months ago

I guess I'll have to wait for a tarball since I got a segmentation fault from the zig binary I built and there's no debug information.