ziglang / zig-bootstrap

take off every zig
390 stars 91 forks source link

Build of a "not tested" triplet: x86_64-windows-musl on WSL-ubuntu, fails #161

Closed BlueSolei closed 3 months ago

BlueSolei commented 1 year ago

Build of x86_64-windows-musl on WSL ubuntu

I tried to build x86_64-windows-musl with mcpu = native on WSL-ubuntu on Windows 11 Pro. I cloned the repo on branch master at commit 1dc1fa6a1.
The command line for the build was: ./build x86_64-windows-musl native

The zig exec at the WSL ubuntu host was created, but it failed to compile a test .c file given it by CMake.
Here is the error printed:

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/shaul/me/expr/expr-zig/zig-bootstrap/out/build-zig-host
[19/20] Install the project...
-- Install configuration: "Release"
-- The C compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/shaul/me/expr/expr-zig/zig-bootstrap/out/host/bin/zig
-- Check for working C compiler: /home/shaul/me/expr/expr-zig/zig-bootstrap/out/host/bin/zig - broken
CMake Error at /usr/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
  The C compiler

    "/home/shaul/me/expr/expr-zig/zig-bootstrap/out/host/bin/zig"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/shaul/me/expr/expr-zig/zig-bootstrap/out/build-zlib-x86_64-windows-musl-native/CMakeFiles/CMakeScratch/TryCompile-H2B8qZ

    Run Build Command(s):/usr/bin/ninja cmTC_ad026 && [1/2] Building C object CMakeFiles/cmTC_ad026.dir/testCCompiler.c.obj
    FAILED: CMakeFiles/cmTC_ad026.dir/testCCompiler.c.obj
    /home/shaul/me/expr/expr-zig/zig-bootstrap/out/host/bin/zig cc -fno-sanitize=all -s -target x86_64-windows-musl -mcpu=native    -o CMakeFiles/cmTC_ad026.dir/testCCompiler.c.obj -c /home/shaul/me/expr/expr-zig/zig-bootstrap/out/build-zlib-x86_64-windows-musl-native/CMakeFiles/CMakeScratch/TryCompile-H2B8qZ/testCCompiler.c
    zig: error: clang frontend command failed with exit code 133 (use -v to see invocation)
    clang version 17.0.3 (https://github.com/ziglang/zig-bootstrap 1dc1fa6a122996fcd030cc956385e055289e09d9)
    Target: x86_64-unknown-windows-musl
    Thread model: posix
    InstalledDir: /home/shaul/me/expr/expr-zig/zig-bootstrap/out/build-zlib-x86_64-windows-musl-native/CMakeFiles/CMakeScratch/TryCompile-H2B8qZ
    zig: note: diagnostic msg:
    ********************

    PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
    Preprocessed source(s) and associated run script(s) are located at:
    zig: note: diagnostic msg: /tmp/testCCompiler-42815b.c
    zig: note: diagnostic msg: /tmp/testCCompiler-42815b.sh
    zig: note: diagnostic msg:

    ********************
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
  CMakeLists.txt:4 (project)

-- Configuring incomplete, errors occurred!
See also "/home/shaul/me/expr/expr-zig/zig-bootstrap/out/build-zlib-x86_64-windows-musl-native/CMakeFiles/CMakeOutput.log".
See also "/home/shaul/me/expr/expr-zig/zig-bootstrap/out/build-zlib-x86_64-windows-musl-native/CMakeFiles/CMakeError.log".

Attached the files: CMakeError.log CMakeOutput.log testCCompiler-42815b.zip

nektro commented 1 year ago

this should compile error afaik. musl is not a valid abi for windows

edit: this this the whole log? not sure from this if it's zig's or clang's fault the error wasn't more clear

matu3ba commented 11 months ago

Unfortunately you dont show the ~~generated relevant cmake error logs. Might be related to https://github.com/ziglang/zig/pull/17824.~~

alexrp commented 3 months ago

Zig could probably give a better error here, but that should be filed on ziglang/zig. This is fundamentally a nonsensical target triple, so it's not really a zig-bootstrap issue.