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 build docs fails on aarch64 #3526

Closed
andrewrk opened this issue Oct 25, 2019 · 2 comments
Closed

zig build docs fails on aarch64 #3526

andrewrk opened this issue Oct 25, 2019 · 2 comments
Labels
arch-aarch64 64-bit ARM bug Observed behavior contradicts documented or intended behavior docs
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Oct 25, 2019

./zig build docs

Outputs:

attempt to unwrap null
reached unreachable code
/deps/install/lib/zig/std/child_process.zig:182:49: 0x24512b in std.child_process.ChildProcess.exec (docgen)
        var stdout_file_in_stream = child.stdout.?.inStream();
                                                ^
/deps/install/lib/zig/std/os.zig:667:22: 0x24b343 in std.os.dup2 (docgen)
            EBADF => unreachable, // always a race condition
                     ^
/deps/zig/doc/docgen.zig:1485:41: 0x2462ff in exec (docgen)
    const result = try ChildProcess.exec(allocator, args, null, env_map, max_doc_file_size);
                                        ^
/deps/install/lib/zig/std/child_process.zig:609:38: 0x24a907 in std.child_process.ChildProcess.setUpChildIo (docgen)
            StdIo.Pipe => try os.dup2(pipe_fd, std_fileno),
                                     ^
/deps/zig/doc/docgen.zig:1510:28: 0x24278f in getBuiltinCode (docgen)
    const result = try exec(allocator, env_map, [_][]const u8{
                           ^
/deps/install/lib/zig/std/child_process.zig:340:25: 0x24a1d3 in std.child_process.ChildProcess.spawnPosix (docgen)
            setUpChildIo(self.stdout_behavior, stdout_pipe[1], os.STDOUT_FILENO, dev_null_fd) catch |err| forkChildErrReport(err_pipe[1], err);
                        ^
/deps/zig/doc/docgen.zig:981:44: 0x2336b3 in genHtml (docgen)
    const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe);
                                           ^
/deps/zig/doc/docgen.zig:56:16: 0x23006f in main (docgen)
    try genHtml(allocator, &tokenizer, &toc, &buffered_out_stream.stream, zig_exe);
      /deps/install/lib/zig/std/child_process.zig : 109 : 35 : 0x 249943  in  std.child_process.ChildProcess.spawn  (^
docgen)
            return self.spawnPosix();
                                  ^
/deps/install/lib/zig/std/special/start.zig:204:37: 0x22ee8b in std.special.posixCallMainAndExit (docgen)
            const result = root.main() catch |err| {
                                    ^
/deps/install/lib/zig/std/child_process.zig:175:24: 0x244f27 in std.child_process.ChildProcess.exec (docgen)
        try child.spawn();
                       ^
/deps/install/lib/zig/std/special/start.zig:102:5: 0x22ed23 in std.special._start (docgen)
    @noInlineCall(posixCallMainAndExit);
    ^
/deps/zig/doc/docgen.zig:1485:41: 0x2462ff in exec (docgen)
    const result = try ChildProcess.exec(allocator, args, null, env_map, max_doc_file_size);
                                        ^
/deps/zig/doc/docgen.zig:1510:28: 0x24278f in getBuiltinCode (docgen)
    const result = try exec(allocator, env_map, [_][]const u8{
                           ^
/deps/zig/doc/docgen.zig:981:44: 0x2336b3 in genHtml (docgen)
    const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe);
                                           ^
/deps/zig/doc/docgen.zig:56:16: 0x23006f in main (docgen)
    try genHtml(allocator, &tokenizer, &toc, &buffered_out_stream.stream, zig_exe);
               ^
/deps/install/lib/zig/std/special/start.zig:204:37: 0x22ee8b in std.special.posixCallMainAndExit (docgen)
            const result = root.main() catch |err| {
                                    ^
The following command terminated unexpectedly:
cd /deps/zig && /deps/zig/zig-cache/o/98n8r9vC4nGn5qF3Sd-2i3ST_zzI8KLzbeEedI2zkEMzolFqfiTyNgVs9aiY0WMX/docgen ../install/bin/zig doc/langref.html.in zig-cache/langref.html 

Build failed. The following command failed:
/deps/zig/zig-cache/o/fmWagUauxJYG5TDzHuY1dSsadLlVX8bK9e8mjM_uQMlxvk7UH62_aP9N2GSFQQaV/build /deps/install/bin/zig /deps/zig /deps/zig/zig-cache docs
/deps/install/lib/zig/std/special/start.zig:102:5: 0x22ed23 in std.special._start (docgen)
    @noInlineCall(posixCallMainAndExit);
    ^

I believe what we're seeing is 2 interleaved stack traces. One from the child and one from the parent (side note- we need locking in stack trace dumping code). The child hits an assertion error at dup2 and the parent hits one when it tries to null-unwrap stdout.

@andrewrk andrewrk added the arch-aarch64 64-bit ARM label Oct 25, 2019
@andrewrk andrewrk added this to the 0.7.0 milestone Oct 25, 2019
@andrewrk andrewrk changed the title zig build docs fails on aarch64 inside docker zig build docs fails on aarch64 Oct 25, 2019
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior docs labels Oct 25, 2019
@LemonBoy
Copy link
Contributor

Not our fault, it's LLVM that miscompiles the if (self.stdin_behavior == StdIo.Pipe) expressions in spawnPosix, leading to os.pipe never being called at all. The good news is that the problem is gone in LLVM 10 (I suspect it's just #3271 again)

@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Nov 12, 2019
@andrewrk
Copy link
Member Author

aarch64 tarballs now ship with docs. There is one test in the docs disabled for aarch64 which is #3282.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-aarch64 64-bit ARM bug Observed behavior contradicts documented or intended behavior docs
Projects
None yet
Development

No branches or pull requests

2 participants