zig-bootstrap
zig-bootstrap copied to clipboard
Current bootstrap cannot build master zig source
Following the instructions here, I run:
# clone zig
# clone zig-bootstrap
# build zig-bootstrap with:
CMAKE_GENERATOR=Ninja ./build native-linux-gnu native
# build zig under the root path with:
/path/to/zig-bootstrap/out/zig-native-linux-gnu-native/bin/zig build -p stage3 --search-prefix /path/to/zig-bootstrap/out/native-linux-gnu-native/ --zig-lib-dir lib -Dstatic-llvm
It fails with a long list fills with:
lib/std/crypto/bcrypt.zig:420:5: error: expected 3 arguments, found 2
@memcpy(password_buf[0..trimmed_len], password[0..trimmed_len]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/std/crypto/bcrypt.zig:629:9: error: expected 3 arguments, found 2
@memcpy(buf[0..hash.len], &hash);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
where zig-bootstrap produce as:
$ zig-bootstrap/out/zig-native-linux-gnu-native/bin/zig version
0.11.0-dev.2680+a1aa55ebe
/path/to/zig-bootstrap/out/zig-native-linux-gnu-native/bin/zig build -p stage3 --search-prefix /path/to/zig-bootstrap/out/native-linux-gnu-native/ --zig-lib-dir lib -Dstatic-llvm
Maybe try to build zig with the same commit as zig-sources in zig-bootstrap.
Otherwise zig can still be bootstrapped from zig cc or ziglang, e. g.
#!/bin/sh
set -eu
ROOTDIR="$(pwd)"
ZIG_DIR=$(python -c "import os; import ziglang; print(os.path.dirname(ziglang.__file__))" 2>&1)
export ZIG_EXE="$ZIG_DIR/zig"
TARGET_OS_CMAKE=""
mkdir -p "$ROOTDIR/out/build-zig-host"
mkdir -p "$ROOTDIR/out/host"
cd "$ROOTDIR/out/build-zig-host"
cmake "$ROOTDIR/zig" \
-DCMAKE_INSTALL_PREFIX="$ROOTDIR/out/host" \
-DCMAKE_PREFIX_PATH="$ROOTDIR/out/host" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="$(pwd)/../../zigcc" \
-DCMAKE_CXX_COMPILER="$(pwd)/../../zigc++" \
-DCMAKE_GENERATOR=Ninja
cmake --build . --target install
ZIG="$ROOTDIR/out/host/bin/zig"
#!/bin/sh
$ZIG_EXE cc $@
#!/bin/sh
$ZIG_EXE c++ $@