ziglang / zig-bootstrap

take off every zig
368 stars 86 forks source link

x86_64-windows-gnu: MSYS2 MinGW supported? #142

Open fleimgruber opened 1 year ago

fleimgruber commented 1 year ago

I tried CMAKE_GENERATOR="Ninja" ./build x86_64-windows-gnu native on a MSYS2 MinGW64 shell and got the error below. I also tried export LDFLAGS=-fstack-protector as it was mentioned a few times in connection with the __stack_chk_guard error below. Is this way of building the compiler even supported or supposed to work?

-- Up-to-date: C:/Users/LeimgruberF/dev/zig-bootstrap/out/host/lib/cmake/llvm/./TensorFlowCompile.cmake
-- Up-to-date: C:/Users/LeimgruberF/dev/zig-bootstrap/out/host/lib/cmake/llvm/./UseLibtool.cmake
-- Up-to-date: C:/Users/LeimgruberF/dev/zig-bootstrap/out/host/lib/cmake/llvm/./VersionFromVCS.cmake
[1/10] Linking CXX static library lib\libclangDriver.a
[2/10] Building CXX object tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.obj
[3/10] Linking CXX executable bin\llvm-config.exe
[4/10] Linking CXX executable bin\clang-ast-dump.exe
[5/10] ASTNodeAPI.json
[6/7] Linking CXX executable bin\clang-diff.exe
[6/7] Install the project...
-- Configuring zig version 0.11.0-dev.534+b0b1cc356
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/LeimgruberF/dev/zig-bootstrap/out/build-zig-host
[1/5] Linking CXX executable zig1.exe
[2/5] Building stage2 object C:/Users/LeimgruberF/dev/zig-bootstrap/out/build-zig-host/zig2.o
[3/5] Linking CXX executable zig2.exe
FAILED: zig2.exe
cmd.exe /C "cd . && C:\Users\LeimgruberF\opt\msys64\mingw64\bin\c++.exe -O3 -DNDEBUG -Wl,--stack,16777216 @CMakeFiles\zig2.rsp -o zig2.exe -Wl,--out-implib,zigcpp\libzig2.dll.a -Wl,--major-image-version,0,--minor-image-version,0  && cd ."
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0xd4): undefined reference to `__stack_chk_fail'
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x196): undefined reference to `__stack_chk_fail'
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x4c1): undefined reference to `__stack_chk_fail'
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x650): undefined reference to `__stack_chk_fail'
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x716): undefined reference to `__stack_chk_fail'
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x7e6): more undefined references to `__stack_chk_fail' follow
C:/Users/LeimgruberF/opt/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]+0x0): undefined reference to `__stack_chk_guard'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.