Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig bootstrap crashes build on ReleaseSafe #19512

Closed
kassane opened this issue Apr 2, 2024 · 6 comments
Closed

Zig bootstrap crashes build on ReleaseSafe #19512

kassane opened this issue Apr 2, 2024 · 6 comments

Comments

@kassane
Copy link
Contributor

kassane commented Apr 2, 2024

Zig Version

0.12.0-dev.3518+d2be725e4

Steps to Reproduce and Observed Behavior

Using latest zig-master src on bootstrap: d2be725

  • build zig (cmake + wasm) [RelSafe]: OK
  • build LLVM using zig: OK
  • build zig using zig(cmake+wasm)[RelSafe]: Fail
./build x86_64-linux-musl baseline
-- Configuring zig version 0.12.0-dev.3518+d2be725e4
-- Configuring done (0.1s)
-- Generating done (0.1s)
-- Build files have been written to: /home/kassane/zig-bootstrap/out/build-zig-host
[ 36%] Built target zigcpp
[ 47%] Built target zig-wasm2c
[ 68%] Built target zig1
[ 73%] Running zig1.wasm to produce /home/kassane/zig-bootstrap/out/build-zig-host/zig2.c
[ 78%] Running zig1.wasm to produce /home/kassane/zig-bootstrap/out/build-zig-host/compiler_rt.c
[ 84%] Building C object CMakeFiles/zig2.dir/zig2.c.o
[ 89%] Building C object CMakeFiles/zig2.dir/compiler_rt.c.o
[ 94%] Linking CXX executable zig2
[ 94%] Built target zig2
[100%] Building stage3
[100%] Built target stage3
Install the project...
-- Install configuration: "Release"
error: sub-compilation of zig_libc failed
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/zig/c_translation.zig:417:16: note: expected 3 arguments, found 2
        return @fieldParentPtr(member, ptr);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/zig/AstGen.zig:11718:66: note: expected 3 arguments, found 2
                .defer_normal, .defer_error => return @alignCast(@fieldParentPtr("base", base)),
                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/http/Client.zig:111:29: note: expected 3 arguments, found 2
        const node: *Node = @fieldParentPtr("data", connection);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Pool.zig:91:46: note: expected 3 arguments, found 2
            const run_node: *RunQueue.Node = @fieldParentPtr("data", runnable);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:647:35: note: expected 3 arguments, found 2
            const head: *Waiter = @fieldParentPtr("node", entry_node);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:659:63: note: expected 3 arguments, found 2
            var queue_head: ?*Waiter = if (entry.node) |node| @fieldParentPtr("node", node) else null;
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:702:39: note: expected 3 arguments, found 2
                const head: *Waiter = @fieldParentPtr("node", entry.node orelse unreachable);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Build.zig:1065:42: note: expected 3 arguments, found 2
    const uninstall_tls: *TopLevelStep = @fieldParentPtr("step", uninstall_step);
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: sub-compilation of compiler_rt failed
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Build.zig:1065:42: note: expected 3 arguments, found 2
    const uninstall_tls: *TopLevelStep = @fieldParentPtr("step", uninstall_step);
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/zig/c_translation.zig:417:16: note: expected 3 arguments, found 2
        return @fieldParentPtr(member, ptr);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/zig/AstGen.zig:11718:66: note: expected 3 arguments, found 2
                .defer_normal, .defer_error => return @alignCast(@fieldParentPtr("base", base)),
                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/http/Client.zig:111:29: note: expected 3 arguments, found 2
        const node: *Node = @fieldParentPtr("data", connection);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Pool.zig:91:46: note: expected 3 arguments, found 2
            const run_node: *RunQueue.Node = @fieldParentPtr("data", runnable);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:647:35: note: expected 3 arguments, found 2
            const head: *Waiter = @fieldParentPtr("node", entry_node);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:659:63: note: expected 3 arguments, found 2
            var queue_head: ?*Waiter = if (entry.node) |node| @fieldParentPtr("node", node) else null;
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:702:39: note: expected 3 arguments, found 2
                const head: *Waiter = @fieldParentPtr("node", entry.node orelse unreachable);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:216:44: error: expected 3 arguments, found 2
        return if (base.tag == T.base_tag) @fieldParentPtr("base", base) else null;
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:373:39: error: expected 3 arguments, found 2
                return @as(*t.Type(), @fieldParentPtr("base", base)).lowerUnnamedConst(val, decl_index);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:392:39: error: expected 3 arguments, found 2
                return @as(*t.Type(), @fieldParentPtr("base", base)).getGlobalSymbol(name, lib_name);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:404:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).updateDecl(module, decl_index);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:420:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(module, func_index, air, liveness);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:432:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).updateDeclLineNumber(module, decl_index);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:456:34: error: expected 3 arguments, found 2
                @as(*tag.Type(), @fieldParentPtr("base", base)).deinit();
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:539:28: error: expected 3 arguments, found 2
            return @as(*C, @fieldParentPtr("base", base)).flush(arena, prog_node);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:577:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).flushModule(arena, prog_node);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:587:34: error: expected 3 arguments, found 2
                @as(*tag.Type(), @fieldParentPtr("base", base)).freeDecl(decl_index);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:610:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).updateExports(module, exported, exports);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:634:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).getDeclVAddr(decl_index, reloc_info);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:653:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).lowerAnonDecl(decl_val, decl_align, src_loc);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:665:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).getAnonDeclVAddr(decl_val, reloc_info);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/link.zig:684:41: error: expected 3 arguments, found 2
                return @as(*tag.Type(), @fieldParentPtr("base", base)).deleteDeclExport(decl_index, name);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/Module.zig:302:50: error: expected 3 arguments, found 2
            return @as(*std.heap.ArenaAllocator, @fieldParentPtr("state", state_acquired)).allocator();
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/Module.zig:312:43: error: expected 3 arguments, found 2
        if (@as(*std.heap.ArenaAllocator, @fieldParentPtr("state", self.state_acquired.?)) == arena_allocator) {
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/Build.zig:1065:42: error: expected 3 arguments, found 2
    const uninstall_tls: *TopLevelStep = @fieldParentPtr("step", uninstall_step);
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/src/register_manager.zig:62:31: error: expected 3 arguments, found 2
            return @alignCast(@fieldParentPtr("register_manager", self));
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/zig/test/standalone/cmakedefine/build.zig:89:46: error: expected 3 arguments, found 2
        const config_header: *ConfigHeader = @fieldParentPtr("step", config_header_step);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/zig/c_translation.zig:417:16: error: expected 3 arguments, found 2
        return @fieldParentPtr(member, ptr);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/zig/AstGen.zig:11718:66: error: expected 3 arguments, found 2
                .defer_normal, .defer_error => return @alignCast(@fieldParentPtr("base", base)),
                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/http/Client.zig:111:29: error: expected 3 arguments, found 2
        const node: *Node = @fieldParentPtr("data", connection);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:647:35: error: expected 3 arguments, found 2
            const head: *Waiter = @fieldParentPtr("node", entry_node);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:659:63: error: expected 3 arguments, found 2
            var queue_head: ?*Waiter = if (entry.node) |node| @fieldParentPtr("node", node) else null;
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Futex.zig:702:39: error: expected 3 arguments, found 2
                const head: *Waiter = @fieldParentPtr("node", entry.node orelse unreachable);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kassane/zig-bootstrap/out/host/lib/zig/std/Thread/Pool.zig:91:46: error: expected 3 arguments, found 2
            const run_node: *RunQueue.Node = @fieldParentPtr("data", runnable);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expected Behavior

Successful build. ReleaseFast works.

  • build zig (cmake + wasm)[RelFast]: Ok
  • build llvm using zig[RelFast]: Ok
  • build zig[RelSafe] using zig[RelFast]: Ok
@kassane kassane added the bug Observed behavior contradicts documented or intended behavior label Apr 2, 2024
@Vexu
Copy link
Member

Vexu commented Apr 2, 2024

Did you update the bootstrap wasm blob as well?

@kassane
Copy link
Contributor Author

kassane commented Apr 2, 2024

Did you update the bootstrap wasm blob as well?

This? e5ba70b (yes)

@kassane
Copy link
Contributor Author

kassane commented Apr 2, 2024

I don't know if it's clear enough.

  • Zig(wasm) build Zig(host) ReleaseSafe: OK
  • Zig(host)[ReleaseSafe] build Zig(triple-targets) ReleaseSafe: Fail

But,

  • Zig(host)[ReleaseFast] build Zig(triple-targets) as ReleaseSafe: Ok

@Vexu
Copy link
Member

Vexu commented Apr 2, 2024

Can you try clearing the global cache?

@kassane
Copy link
Contributor Author

kassane commented Apr 2, 2024

Can you try clearing the global cache?

clean (global + local) cache, get same error!

@nm-remarkable
Copy link

nm-remarkable commented May 5, 2024

There were some breaking changes to @fieldParentPtr. Ref: #19470

@andrewrk andrewrk closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2024
@andrewrk andrewrk removed the bug Observed behavior contradicts documented or intended behavior label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants