ziglang / zig-bootstrap

take off every zig
368 stars 86 forks source link

linux: Unable to compile #127

Closed ryuukk closed 2 weeks ago

ryuukk commented 1 year ago

I tried to compile the latest version using the bootstrap, but i get the following error:

./build -j4 x86_64-linux-musl baseline

i also tried

./build -j4 x86_64-linux-gnu baseline

[100%] Building stage3
Semantic Analysis [3939] minimal_capacity... Semantic Analysis [606] __fixsfti..Compile C Objects [13/21] analyze.cpp... error(compilation): clang failed with stderr: /home/ryuukk/dev/zig-bootstrap/zig/src/stage1/codegen.cpp:4838:17: error: use of undeclared identifier 'LLVMPointerTypeInContext'
/home/ryuukk/dev/zig-bootstrap/zig/src/stage1/codegen.cpp:5183:17: error: use of undeclared identifier 'LLVMPointerTypeInContext'

Semantic Analysis... Compile C Objects [4Compile C Objects [19/21] analyze.cpp../home/ryuukk/dev/zig-bootstrap/zig/src/stage1/codegen.cpp:1:1: error: unable to build C object: clang exited with code 1
error: zig...
error: The following command exited with error code 1:
kassane commented 1 year ago

Same error:

[100%] Building stage3
Compile C Objects [14/21] analyze.cpp... error(compilation): clang failed with stderr: /home/kassane/Code/zig-bootstrap/zig/src/stage1/codegen.cpp:4838:17: error: use of undeclared identifier 'LLVMPointerTypeInContext'
/home/kassane/Code/zig-bootstrap/zig/src/stage1/codegen.cpp:5183:17: error: use of undeclared identifier 'LLVMPointerTypeInContext'

/home/kassane/Code/zig-bootstrap/zig/src/stage1/codegen.cpp:1:1: error: unable to build C object: clang exited with code 1
error: zig...
error: The following command exited with error code 1:
/home/kassane/Code/zig-bootstrap/out/build-zig-host/zig2 build-exe --stack 33554432 /home/kassane/Code/zig-bootstrap/zig/src/stage1.zig -lc -cflags -std=c++14 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces -Wno-comment -- /home/kassane/Code/zig-bootstrap/zig/src/stage1/analyze.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/astgen.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/bigfloat.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/bigint.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/buffer.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/codegen.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/errmsg.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/error.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/heap.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/ir.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/ir_print.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/mem.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/os.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/parser.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/range_set.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/stage1.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/target.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/tokenizer.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/util.cpp /home/kassane/Code/zig-bootstrap/zig/src/stage1/softfloat_ext.cpp -cflags -std=c99 -O3 -- /home/kassane/Code/zig-bootstrap/zig/src/stage1/parse_f128.c /home/kassane/Code/zig-bootstrap/zig/zig-cache/o/a97c579105f4fbd2d4a4fd3d3ecc1ef9/libsoftfloat.a -lc++ /home/kassane/Code/zig-bootstrap/out/build-zig-host/zigcpp/libzigcpp.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangFrontendTool.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangCodeGen.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangFrontend.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangDriver.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangSerialization.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangSema.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangStaticAnalyzerFrontend.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangStaticAnalyzerCheckers.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangStaticAnalyzerCore.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangAnalysis.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangASTMatchers.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangAST.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangParse.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangSema.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangBasic.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangEdit.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangLex.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangARCMigrate.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangRewriteFrontend.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangRewrite.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangCrossTU.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangIndex.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangToolingCore.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangExtractAPI.a /home/kassane/Code/zig-bootstrap/out/host/lib/libclangSupport.a /home/kassane/Code/zig-bootstrap/out/host/lib/liblldMinGW.a /home/kassane/Code/zig-bootstrap/out/host/lib/liblldELF.a /home/kassane/Code/zig-bootstrap/out/host/lib/liblldCOFF.a /home/kassane/Code/zig-bootstrap/out/host/lib/liblldWasm.a /home/kassane/Code/zig-bootstrap/out/host/lib/liblldMachO.a /home/kassane/Code/zig-bootstrap/out/host/lib/liblldCommon.a -lLLVMWindowsManifest -lLLVMWindowsDriver -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDriver -lLLVMCoverage -lLLVMLineEditor -lLLVMXtensaDisassembler -lLLVMXtensaAsmParser -lLLVMXtensaCodeGen -lLLVMXtensaDesc -lLLVMXtensaInfo -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyUtils -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -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 -lLLVMOrcJIT -lLLVMMCJIT -lLLVMJITLink -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMDWP -lLLVMDebugInfoGSYM -lLLVMOption -lLLVMObjectYAML -lLLVMObjCopy -lLLVMMCA -lLLVMMCDisassembler -lLLVMLTO -lLLVMPasses -lLLVMCFGuard -lLLVMCoroutines -lLLVMObjCARCOpts -lLLVMipo -lLLVMVectorize -lLLVMLinker -lLLVMInstrumentation -lLLVMFrontendOpenMP -lLLVMFrontendOpenACC -lLLVMExtensions -lLLVMDWARFLinker -lLLVMGlobalISel -lLLVMMIRParser -lLLVMAsmPrinter -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMIRReader -lLLVMAsmParser -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMFuzzMutate -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMFuzzerCLI -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMTableGen -lLLVMSupport -lLLVMDemangle /usr/lib/libzstd.so.1.5.2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncursesw /usr/lib/libz.a /usr/lib64/libstdc++.a -lunwind --strip -OReleaseFast --cache-dir /home/kassane/Code/zig-bootstrap/zig/zig-cache --global-cache-dir /home/kassane/.cache/zig --name zig -target native-native -mcpu x86_64 --pkg-begin build_options /home/kassane/Code/zig-bootstrap/zig/zig-cache/options/J5FbJDSH6I-tNMrlfl8VHIpsxBTxan6DCI9KApRqJGqUHx91zgmlCUvRSfIMKEka --pkg-end --pkg-begin compiler_rt /home/kassane/Code/zig-bootstrap/zig/src/empty.zig --pkg-end -I /home/kassane/Code/zig-bootstrap/zig/src -I /home/kassane/Code/zig-bootstrap/zig/deps/SoftFloat-3e/source/include -I /home/kassane/Code/zig-bootstrap/zig/deps/SoftFloat-3e-prebuilt -I /home/kassane/Code/zig-bootstrap/out/host/include -D ZIG_LINK_MODE=Static -L /home/kassane/Code/zig-bootstrap/out/host/lib -isystem /home/kassane/Code/zig-bootstrap/out/host/include -fno-build-id --zig-lib-dir /home/kassane/Code/zig-bootstrap/zig/lib --enable-cache 
error: the following build command failed with exit code 1:
/home/kassane/Code/zig-bootstrap/zig/zig-cache/o/4578744fb0741db02e0d3705720871f1/build /home/kassane/Code/zig-bootstrap/out/build-zig-host/zig2 /home/kassane/Code/zig-bootstrap/zig /home/kassane/Code/zig-bootstrap/zig/zig-cache /home/kassane/.cache/zig --zig-lib-dir /home/kassane/Code/zig-bootstrap/zig/lib --prefix /home/kassane/Code/zig-bootstrap/out/host -Dconfig_h=/home/kassane/Code/zig-bootstrap/out/build-zig-host/config.h -Denable-llvm -Denable-stage1 -Drelease -Dstrip -Dskip-install-lib-files=false -Dtarget=native -Dcpu=baseline -Dversion-string=0.10.0-dev.4193+f3a1b5c48
make[2]: *** [CMakeFiles/stage3.dir/build.make:71: CMakeFiles/stage3] Error 1
make[1]: *** [CMakeFiles/Makefile2:260: CMakeFiles/stage3.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Ref.:

kassane commented 1 year ago

I was able to build without this error when uninstalling llvm from Archlinux.

matu3ba commented 1 year ago

Looks like you are both running into https://github.com/ziglang/zig/issues/12888.

Unfortunately https://github.com/ziglang/zig/pull/12898 has not been merged yet, which would resolve that issue + making aware the clang/gcc footgun.

matu3ba commented 1 year ago

@ryuukk Has this been fixed with zig wasi bootstrap being merged to ziglang/zig repo?

matu3ba commented 1 year ago

see also #141