-
-
Couldn't load subscription status.
- Fork 110
Description
Zig Version
0.15.2
Steps to Reproduce and Observed Behavior
Steps to Reproduce
-
Create a Dockerfile with the
alpine:3.22.2image as the base -
RUN git clone --recursive --depth=1 --branch=0.15.2 https://github.com/ziglang/zig-bootstrap.git(also happens with the zig source, but I like to build with build systems available if I can) -
RUN apk add --no-cache build-base cmake llvm20 llvm20-dev clang20 clang20-dev lld20 lld20-dev clang20-headers samuraito install build tools and dependencies (samurai is a drop in replacement for ninja that is now becoming a default for Alpine) -
Set these to force CMake to use Samurai to compile the code:
ENV CMAKE_GENERATOR="Ninja"
ENV ZIG_STATIC="ON"
-
RUN cd zig-bootstrap && sh build x86_64-linux-musl baseline- Setting x86_64 or baseline to native doesn't affect the outcome -
Wait for Stage 1 to complete and then expect Stage 2 to fail
Following the Build instructions for the zig sources (or using the official Alpine build script as a base for what to pass to Cmake) both have the exact same issue
Observed Behavior
6684.5 [1/20] Building C object CMakeFiles/zig-wasm2c.dir/stage1/wasm2c.c.o
6684.5 [2/20] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1as_main.cpp.o
6684.5 [3/20] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1_main.cpp.o
6684.5 [4/20] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_driver.cpp.o
6684.5 [5/20] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang.cpp.o
6684.5 [6/20] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm-ar.cpp.o
6684.5 [7/20] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o
6687.3 [8/20] Linking C executable zig-wasm2c
6687.3 [9/20] Converting /zig-bootstrap/zig/stage1/zig1.wasm to /zig-bootstrap/out/build-zig-host/zig1.c
6690.4 [10/20] Building C object CMakeFiles/zig1.dir/zig1.c.o
6690.4 [11/20] Building C object CMakeFiles/zig1.dir/stage1/wasi.c.o
6702.4 [12/20] Linking CXX static library zigcpp/libzigcpp.a
6872.5 [13/20] Linking C executable zig1
6872.6 [14/20] Running zig1.wasm to produce /zig-bootstrap/out/build-zig-host/compiler_rt.c
6872.6 [15/20] Running zig1.wasm to produce /zig-bootstrap/out/build-zig-host/zig2.c
6879.3 /zig-bootstrap/out/build-zig-host/config.zig:1:1: error: unable to load 'config.zig': FileNotFound
6879.3 src/main.zig:28:31: note: file imported here
6879.3 const build_options = @import("build_options");
6879.3 ^~~~~~~~~~~~~~~
6879.3 ninja: job failed: cd /zig-bootstrap/zig && /zig-bootstrap/out/build-zig-host/zig1 /zig-bootstrap/zig/lib build-exe -ofmt=c -lc -OReleaseSmall --name zig2 -femit-bin="/zig-bootstrap/out/build-zig-host/zig2.c" -target x86_64-linux --dep build_options --dep aro -Mroot=src/main.zig -Mbuild_options=/cache/deps/zig/out/build-zig-host/config.zig -Maro=lib/compiler/aro/aro.zig
6879.3 ninja: subcommand failed
I've also observed that building Stage 2 tries to use GCC 14 instead of Clang 20 even when explicitly setting Cmake to use Clang. The same issue also occurs using make instead of ninja/samurai (albeit building being much slower)
Expected Behavior
All stages complete without issues and a Stage3 build should be available to use when building Zig, Nim or any other languages that compile with Clang as native C/C++ code