Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current bootstrap cannot build master zig source #153

Open
tisonkun opened this issue May 27, 2023 · 1 comment
Open

Current bootstrap cannot build master zig source #153

tisonkun opened this issue May 27, 2023 · 1 comment

Comments

@tisonkun
Copy link

tisonkun commented May 27, 2023

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
@LinuxUserGD
Copy link
Contributor

LinuxUserGD commented Jul 22, 2023

/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++ $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants