I'm trying to build the latest master branch, but my linux distro (ubuntu) does not have llvm 15 in the repo, so I'm trying to use zig-bootstrap. Following the instructions in the wiki (although I can see they haven't been updated since to switch to llvm 15) for option B using zig-bootstrap, I get linking errors when building the compiler. To build the compile I did the following:
- built zig-bootstrap with
./build native-linux-gnu baseline(also tried with./build native-linux-gnu nativegives the same behaviour later) - set
$ZIG_PREFIXandLLVM_PREFIXto/path/to/zig-bootstrap/out/host. - created the cmake build directory with:
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=$LLVM_PREFIX
I also tried with -DZIG_LLVM_STATIC=ON set as well
- attempted to compile zig with
"$ZIG_PREFIX/bin/zig" build -p stage3 --search-prefix "$LLVM_PREFIX" --zig-lib-dir lib -Dstatic-llvmthe compilation fails with what looks like a few hundred lines of linking errors (all undefined symbols) followed by some
LLD Link... ld.lld: error: undefined symbol: llvm::SubtargetFeatures::getString() const
> referenced by zig_llvm.cpp:101 (src/zig_llvm.cpp:101)
> >>> /path/to/zig/src/zig-cache/o/81e5cf657f15e4815f5bb4f29e7a6c5d/zig_llvm.o:(ZigLLVMGetNativeFeatures)
> ```.
I have tried uninstalling the system `llvm-dev` package that I used to build older versions of `zig` in case somehow the wrong version of some llvm tools were causing issues (I've just found that apparently I still have the package `llvm-14-linker-tools` on my system, which provides lld so maybe the wrong lld binary is being used?).
I have also tried building without `-Dstatic-llvm` in which case the compiler builds, but when I try to use it it panics with an integer overflow and dumps a bunch of (I think its) ZIR.
Can anyone point me in the right direction to try and get the master branch building?