ziglang / zig-bootstrap

take off every zig
372 stars 86 forks source link

cross: x86_64-windows-gnu - WritingImportLibFailed #193

Open kassane opened 6 days ago

kassane commented 6 days ago

Tested on ArchLinux (x86_64/zen3)

Note: any other target macos and/or linux works, no issue!

$ ./build x86_64-windows-gnu baseline
install
└─ install zig
   └─ zig build-exe zig ReleaseFast x86_64-windows-gnu 1 errors
error: unable to generate DLL import .lib file for crypt32: WritingImportLibFailed
error: error(mingw): unable to turn version.def into version.lib
error(mingw): unable to turn ole32.def into ole32.lib
error(mingw): unable to turn ws2_32.def into ws2_32.lib
error(mingw): unable to turn api-ms-win-crt-conio-l1-1-0.def into api-ms-win-crt-conio-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-convert-l1-1-0.def into api-ms-win-crt-convert-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-environment-l1-1-0.def into api-ms-win-crt-environment-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-filesystem-l1-1-0.def into api-ms-win-crt-filesystem-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-heap-l1-1-0.def into api-ms-win-crt-heap-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-locale-l1-1-0.def into api-ms-win-crt-locale-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-math-l1-1-0.def into api-ms-win-crt-math-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-multibyte-l1-1-0.def into api-ms-win-crt-multibyte-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-private-l1-1-0.def into api-ms-win-crt-private-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-process-l1-1-0.def into api-ms-win-crt-process-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-runtime-l1-1-0.def into api-ms-win-crt-runtime-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-stdio-l1-1-0.def into api-ms-win-crt-stdio-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-string-l1-1-0.def into api-ms-win-crt-string-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-time-l1-1-0.def into api-ms-win-crt-time-l1-1-0.lib
error(mingw): unable to turn api-ms-win-crt-utility-l1-1-0.def into api-ms-win-crt-utility-l1-1-0.lib
error(mingw): unable to turn advapi32.def into advapi32.lib
error(mingw): unable to turn kernel32.def into kernel32.lib
error(mingw): unable to turn ntdll.def into ntdll.lib
error(mingw): unable to turn shell32.def into shell32.lib
error(mingw): unable to turn user32.def into user32.lib
error(mingw): unable to turn crypt32.def into crypt32.lib

error: the following command failed with 1 compilation errors:
/home/kassane/zig-bootstrap/out/host/bin/zig build-exe --stack 33554432 -cflags -std=c++17 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fno-exceptions -fno-rtti -fno-stack-protector -fvisibility-inlines-hidden -Wno-type-limits -Wno-missing-braces -Wno-comment -DNDEBUG=1 -- /home/kassane/zig-bootstrap/zig/src/zig_llvm.cpp /home/kassane/zig-bootstrap/zig/src/zig_clang.cpp /home/kassane/zig-bootstrap/zig/src/zig_llvm-ar.cpp /home/kassane/zig-bootstrap/zig/src/zig_clang_driver.cpp /home/kassane/zig-bootstrap/zig/src/zig_clang_cc1_main.cpp /home/kassane/zig-bootstrap/zig/src/zig_clang_cc1as_main.cpp -lclangFrontendTool -lclangCodeGen -lclangFrontend -lclangDriver -lclangSerialization -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangAnalysis -lclangASTMatchers -lclangAST -lclangParse -lclangAPINotes -lclangBasic -lclangEdit -lclangLex -lclangARCMigrate -lclangRewriteFrontend -lclangRewrite -lclangCrossTU -lclangIndex -lclangToolingCore -lclangExtractAPI -lclangSupport -lclangInstallAPI -llldMinGW -llldELF -llldCOFF -llldWasm -llldMachO -llldCommon -lLLVMWindowsManifest -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDriver -lLLVMTextAPIBinaryReader -lLLVMCoverage -lLLVMLineEditor -lLLVMSandboxIR -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAMDGPUTargetMCA -lLLVMAMDGPUDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMOrcDebugging -lLLVMOrcJIT -lLLVMWindowsDriver -lLLVMMCJIT -lLLVMJITLink -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMDWP -lLLVMDebugInfoLogicalView -lLLVMDebugInfoGSYM -lLLVMOption -lLLVMObjectYAML -lLLVMObjCopy -lLLVMMCA -lLLVMMCDisassembler -lLLVMLTO -lLLVMPasses -lLLVMHipStdPar -lLLVMCFGuard -lLLVMCoroutines -lLLVMipo -lLLVMVectorize -lLLVMLinker -lLLVMInstrumentation -lLLVMFrontendOpenMP -lLLVMFrontendOffloading -lLLVMFrontendOpenACC -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMExtensions -lLLVMDWARFLinkerParallel -lLLVMDWARFLinkerClassic -lLLVMDWARFLinker -lLLVMGlobalISel -lLLVMMIRParser -lLLVMAsmPrinter -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMTarget -lLLVMObjCARCOpts -lLLVMCodeGenTypes -lLLVMIRPrinter -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMFuzzMutate -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMFuzzerCLI -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lzstd -lversion -lole32 -lws2_32 -fstrip -fno-sanitize-thread -OReleaseFast -target x86_64-windows-gnu -mcpu baseline --dep aro --dep aro_translate_c --dep build_options -Mroot=/home/kassane/zig-bootstrap/zig/src/main.zig -Maro=/home/kassane/zig-bootstrap/zig/lib/compiler/aro/aro.zig --dep aro -Maro_translate_c=/home/kassane/zig-bootstrap/zig/lib/compiler/aro_translate_c.zig -Mbuild_options=/home/kassane/zig-bootstrap/zig/.zig-cache/c/693995afb687fc319b6a31b36e3f4d0f/options.zig -lc++ -lc --cache-dir /home/kassane/zig-bootstrap/zig/.zig-cache --global-cache-dir /home/kassane/.cache/zig --name zig -L /home/kassane/zig-bootstrap/out/x86_64-windows-gnu-baseline/lib -I /home/kassane/zig-bootstrap/out/x86_64-windows-gnu-baseline/include --zig-lib-dir /home/kassane/zig-bootstrap/out/host/lib/zig/ -fno-lto --listen=- 
Build Summary: 4/7 steps succeeded; 1 failed
install transitive failure
└─ install zig transitive failure
   └─ zig build-exe zig ReleaseFast x86_64-windows-gnu 1 errors
error: the following build command failed with exit code 1:
/home/kassane/zig-bootstrap/zig/.zig-cache/o/ad9a0af8fd28e444bdb5213fe9a5ef3f/build /home/kassane/zig-bootstrap/out/host/bin/zig /home/kassane/zig-bootstrap/out/host/lib/zig /home/kassane/zig-bootstrap/zig /home/kassane/zig-bootstrap/zig/.zig-cache /home/kassane/.cache/zig --seed 0x8f66a735 -Z6732ef3e02f43601 --prefix /home/kassane/zig-bootstrap/out/zig-x86_64-windows-gnu-baseline --search-prefix /home/kassane/zig-bootstrap/out/x86_64-windows-gnu-baseline -Dflat -Dstatic-llvm -Doptimize=ReleaseFast -Dno-langref -Dskip-release -Dskip-debug -Dskip-non-native -Dstrip -Dtarget=x86_64-windows-gnu -Dcpu=baseline -Dversion-string=0.14.0-dev.1622+2ac543388
alexrp commented 6 days ago

FWIW, this works for me on Ubuntu 23.10 (x86_64). You'll have to step into LLVM to figure out what's going wrong:

https://github.com/ziglang/zig/blob/d83a3f1746c81026d1cf0244156513c9b5a2a9f6/src/mingw.zig#L285-L289