ziglang / zig

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

docgen fails to cross compiling for windows on linux host #15205

Open perillo opened 1 year ago

perillo commented 1 year ago

Zig Version

0.11.0-dev.2401+348751462

Steps to Reproduce and Observed Behavior

build/stage3/bin/zig build --prefix /data/spool/zig -Dtarget=x86_64-windows
zig build-exe zig Debug x86_64-windows: error: the following command failed with 2 compilation errors:
/home/manlio/src/contrib/zig/github.com/perillo/zig/build/stage3/bin/zig build-exe --stack 33554432 /home/manlio/src/contrib/zig/github.com/perillo/zig/src/main.zig --cache-dir /home/manlio/src/contrib/zig/github.com/perillo/zig/zig-cache --global-cache-dir /home/manlio/.cache/zig --name zig -target x86_64-windows -mcpu x86_64 --mod build_options::/home/manlio/src/contrib/zig/github.com/perillo/zig/zig-cache/c/910dce64078a7561b60342bdc3714da2/options.zig --deps build_options -fno-build-id -fno-lto --enable-cache --listen=- 
run docgen (langref.html): error: error: lld-link: could not open '/home/manlio/.cache/zig/o/a607d807adb246ae33def8b810920fc1/kernel32.lib': No such file or directory
error: lld-link: could not open '/home/manlio/.cache/zig/o/8522759cf6bccbac1d86402cb7150d2d/ntdll.lib': No such file or directory

The following command exited with code 1:
/home/manlio/src/contrib/zig/github.com/perillo/zig/build/stage3/bin/zig test docgen_tmp/test_noreturn_from_exit.zig -target x86_64-windows --test-no-exec 
/home/manlio/src/contrib/zig/github.com/perillo/zig/doc/langref.html.in:5120:25: error: test failed
      {#target_windows#}

error: ParseError
/home/manlio/src/contrib/zig/github.com/perillo/zig/doc/docgen.zig:1861:17: 0x28381d in exec (docgen)
                return error.ChildExitError;
                ^
/home/manlio/src/contrib/zig/github.com/perillo/zig/doc/docgen.zig:287:5: 0x29f294 in parseError__anon_6588 (docgen)
    return error.ParseError;
    ^
/home/manlio/src/contrib/zig/github.com/perillo/zig/doc/docgen.zig:1583:29: 0x296590 in genHtml__anon_4648 (docgen)
                            return parseError(tokenizer, code.source_token, "test failed", .{});
                            ^
/home/manlio/src/contrib/zig/github.com/perillo/zig/doc/docgen.zig:104:5: 0x2a58f3 in main (docgen)
    try genHtml(allocator, &tokenizer, &toc, buffered_writer.writer(), zig_exe, opt_zig_lib_dir, do_code_tests);
    ^

run docgen (langref.html): error: the following command exited with error code 1:
/home/manlio/src/contrib/zig/github.com/perillo/zig/zig-cache/o/7d5d6141b32df70742f3b95e912d3d3b/docgen --zig /home/manlio/src/contrib/zig/github.com/perillo/zig/build/stage3/bin/zig /home/manlio/src/contrib/zig/github.com/perillo/zig/doc/langref.html.in /home/manlio/src/contrib/zig/github.com/perillo/zig/zig-cache/o/0ca64785b60d183e7bae2353c48b16d1/langref.html 
Build Summary: 3/8 steps succeeded; 2 failed (disable with -fno-summary)
install transitive failure
├─ install generated to doc/langref.html transitive failure
│  └─ run docgen (langref.html) failure
│     └─ zig build-exe docgen Debug native cached 78ms MaxRSS:96M
├─ install lib/ cached
└─ install zig transitive failure
   └─ zig build-exe zig Debug x86_64-windows 2 errors
      └─ options success
error: lld-link: could not open '/home/manlio/.cache/zig/o/a607d807adb246ae33def8b810920fc1/kernel32.lib': No such file or directory
error: lld-link: could not open '/home/manlio/.cache/zig/o/8522759cf6bccbac1d86402cb7150d2d/ntdll.lib': No such file or directory

The problem is that I have wine installed, with binfmt_misc enabled.

Expected Behavior

No errors.

andrewrk commented 1 year ago

This looks completely unrelated to wine. It is a bug in docgen when cross-compiling the language reference.

perillo commented 1 year ago

This looks completely unrelated to wine. It is a bug in docgen when cross-compiling the language reference.

Yes. My comment was misleading. Wine being enabled in binfmt_misc was just the trigger.