Zig Version
build from bootstrap.c at d0226ac301
Steps to Reproduce and Observed Behavior
I was trying to build the compiler from scratch (I want to contribute to ziglibc) and encountered following issue in zig2:
a.out was build with
❯ gcc --version
gcc (GCC) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and this is what I tried:
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./a.out
cc -o zig-wasm2c stage1/wasm2c.c -O2 -std=c99
./zig-wasm2c stage1/zig1.wasm zig1.c
cc -o zig1 zig1.c stage1/wasi.c -std=c99 -Os -fno-strict-aliasing -lm
./zig1 lib build-exe -ofmt=c -lc -OReleaseSmall --name zig2 -femit-bin=zig2.c -target x86_64-linux --dep build_options --dep aro -Mroot=src/main.zig -Mbuild_options=config.zig -Maro=lib/compiler/aro/aro.zig
./zig1 lib build-obj -ofmt=c -OReleaseSmall --name compiler_rt -femit-bin=compiler_rt.c -target x86_64-linux -Mroot=lib/compiler_rt.zig
cc -o zig2 zig2.c compiler_rt.c -std=c99 -O2 -fno-stack-protector -Istage1 -Wl,-z,stack-size=0x10000000 -pthread -fno-strict-aliasing -Wno-address-of-packed-member
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2 took 8m23s
❯ ls
ci/
cmake/
doc/
lib/
src/
stage1/
test/
tools/
a.out*
bootstrap.c
build.zig
build.zig.zon
CMakeLists.txt
compiler_rt.c
config.zig
LICENSE
README.md
zig-wasm2c*
zig1*
zig1.c
zig2*
zig2.c
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./zig2
error: expected command argument
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ !! -h
./zig2 -h
thread 15608 panic: development environment core does not support feature help_command
Cannot print stack trace: stack tracing is disabled
Aborted (core dumped) ./zig2 -h
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./zig2 --help
thread 15704 panic: development environment core does not support feature help_command
Cannot print stack trace: stack tracing is disabled
Aborted (core dumped) ./zig2 --help
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./zig2 build
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (wasi_args.out) failure
error: missing compiler runtime intrinsic '__multi3' (undefined linker symbol)
The following command exited with code 1:
../../../zig2 build-exe --name wasi_args --color on ../../../doc/langref/wasi_args.zig --zig-lib-dir ../../../lib -target wasm32-wasi
error: example failed to compile
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/wasi_args.zig -o /home/martin/Documents/zig/.zig-cache/o/02ace588f39dc22252f834edea361652/wasi_args.out
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (math.out) failure
error: zig compilation unit: undefined function: print
The following command exited with code 1:
../../../zig2 build-exe --name math --color on ../../../doc/langref/math.zig --zig-lib-dir ../../../lib -target wasm32-freestanding -fno-entry --export=add
error: example failed to compile
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/math.zig -o /home/martin/Documents/zig/.zig-cache/o/238aea1f02ebe1c6df3242d953c92b14/math.out
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (wasi_preopens.out) failure
error: missing compiler runtime intrinsic '__multi3' (undefined linker symbol)
The following command exited with code 1:
../../../zig2 build-exe --name wasi_preopens --color on ../../../doc/langref/wasi_preopens.zig --zig-lib-dir ../../../lib -target wasm32-wasi
error: example failed to compile
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/wasi_preopens.zig -o /home/martin/Documents/zig/.zig-cache/o/f941fa4590bbcebc49d78d1fc7c40c05/wasi_preopens.out
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (test_global_assembly.out) failure
error: producing machine code via LLVM requires using the LLVM library
The following command exited with code 1:
../../../zig2 test ../../../doc/langref/test_global_assembly.zig --zig-lib-dir ../../../lib -target x86_64-linux -fllvm
error: test failed
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/test_global_assembly.zig -o /home/martin/Documents/zig/.zig-cache/o/890b011083e3aeac62bf5afc7a5e0ec5/test_global_assembly.out
Build Summary: 291/299 steps succeeded (4 failed)
install transitive failure
└─ install generated to doc/langref.html transitive failure
└─ run exe docgen (langref.html) transitive failure
└─ WriteFile error_return_trace.out transitive failure
├─ run exe doctest (math.out) failure
├─ run exe doctest (wasi_args.out) failure
├─ run exe doctest (wasi_preopens.out) failure
└─ run exe doctest (test_global_assembly.out) failure
error: the following build command failed with exit code 1:
.zig-cache/o/88d4f5c4594580b19d2751efc249e762/build /home/martin/Documents/zig/zig2 lib /home/martin/Documents/zig .zig-cache /home/martin/.cache/zig --seed 0x4a62b066 -Z0465cc65eda3f281
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2 took 2m1s
❯
Expected Behavior
finish building ig
Edit:
mb, maybe i should have read the readme where it says I should not do this and Instead use make ...
### Zig Version
build from bootstrap.c at d0226ac301140cb552dfc3da24cea7693d29c64f
### Steps to Reproduce and Observed Behavior
I was trying to build the compiler from scratch (I want to contribute to ziglibc) and encountered following issue in zig2:
a.out was build with
```
❯ gcc --version
gcc (GCC) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
and this is what I tried:
```
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./a.out
cc -o zig-wasm2c stage1/wasm2c.c -O2 -std=c99
./zig-wasm2c stage1/zig1.wasm zig1.c
cc -o zig1 zig1.c stage1/wasi.c -std=c99 -Os -fno-strict-aliasing -lm
./zig1 lib build-exe -ofmt=c -lc -OReleaseSmall --name zig2 -femit-bin=zig2.c -target x86_64-linux --dep build_options --dep aro -Mroot=src/main.zig -Mbuild_options=config.zig -Maro=lib/compiler/aro/aro.zig
./zig1 lib build-obj -ofmt=c -OReleaseSmall --name compiler_rt -femit-bin=compiler_rt.c -target x86_64-linux -Mroot=lib/compiler_rt.zig
cc -o zig2 zig2.c compiler_rt.c -std=c99 -O2 -fno-stack-protector -Istage1 -Wl,-z,stack-size=0x10000000 -pthread -fno-strict-aliasing -Wno-address-of-packed-member
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2 took 8m23s
❯ ls
ci/
cmake/
doc/
lib/
src/
stage1/
test/
tools/
a.out*
bootstrap.c
build.zig
build.zig.zon
CMakeLists.txt
compiler_rt.c
config.zig
LICENSE
README.md
zig-wasm2c*
zig1*
zig1.c
zig2*
zig2.c
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./zig2
error: expected command argument
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ !! -h
./zig2 -h
thread 15608 panic: development environment core does not support feature help_command
Cannot print stack trace: stack tracing is disabled
Aborted (core dumped) ./zig2 -h
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./zig2 --help
thread 15704 panic: development environment core does not support feature help_command
Cannot print stack trace: stack tracing is disabled
Aborted (core dumped) ./zig2 --help
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2
❯ ./zig2 build
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (wasi_args.out) failure
error: missing compiler runtime intrinsic '__multi3' (undefined linker symbol)
The following command exited with code 1:
../../../zig2 build-exe --name wasi_args --color on ../../../doc/langref/wasi_args.zig --zig-lib-dir ../../../lib -target wasm32-wasi
error: example failed to compile
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/wasi_args.zig -o /home/martin/Documents/zig/.zig-cache/o/02ace588f39dc22252f834edea361652/wasi_args.out
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (math.out) failure
error: zig compilation unit: undefined function: print
The following command exited with code 1:
../../../zig2 build-exe --name math --color on ../../../doc/langref/math.zig --zig-lib-dir ../../../lib -target wasm32-freestanding -fno-entry --export=add
error: example failed to compile
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/math.zig -o /home/martin/Documents/zig/.zig-cache/o/238aea1f02ebe1c6df3242d953c92b14/math.out
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (wasi_preopens.out) failure
error: missing compiler runtime intrinsic '__multi3' (undefined linker symbol)
The following command exited with code 1:
../../../zig2 build-exe --name wasi_preopens --color on ../../../doc/langref/wasi_preopens.zig --zig-lib-dir ../../../lib -target wasm32-wasi
error: example failed to compile
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/wasi_preopens.zig -o /home/martin/Documents/zig/.zig-cache/o/f941fa4590bbcebc49d78d1fc7c40c05/wasi_preopens.out
install
└─ install generated to doc/langref.html
└─ run exe docgen (langref.html)
└─ WriteFile error_return_trace.out
└─ run exe doctest (test_global_assembly.out) failure
error: producing machine code via LLVM requires using the LLVM library
The following command exited with code 1:
../../../zig2 test ../../../doc/langref/test_global_assembly.zig --zig-lib-dir ../../../lib -target x86_64-linux -fllvm
error: test failed
error: process exited with error code 1
failed command: ./.zig-cache/o/f21e5c38c707478267df40220d6599b1/doctest --zig /home/martin/Documents/zig/zig2 --cache-root .zig-cache --zig-lib-dir lib/ -i /home/martin/Documents/zig/doc/langref/test_global_assembly.zig -o /home/martin/Documents/zig/.zig-cache/o/890b011083e3aeac62bf5afc7a5e0ec5/test_global_assembly.out
Build Summary: 291/299 steps succeeded (4 failed)
install transitive failure
└─ install generated to doc/langref.html transitive failure
└─ run exe docgen (langref.html) transitive failure
└─ WriteFile error_return_trace.out transitive failure
├─ run exe doctest (math.out) failure
├─ run exe doctest (wasi_args.out) failure
├─ run exe doctest (wasi_preopens.out) failure
└─ run exe doctest (test_global_assembly.out) failure
error: the following build command failed with exit code 1:
.zig-cache/o/88d4f5c4594580b19d2751efc249e762/build /home/martin/Documents/zig/zig2 lib /home/martin/Documents/zig .zig-cache /home/martin/.cache/zig --seed 0x4a62b066 -Z0465cc65eda3f281
zig on master [?] via C v15.2.0-gcc via △しろさんかく via ↯ v0.15.2 took 2m1s
❯
```
### Expected Behavior
finish building ig
Edit:
mb, maybe i should have read the readme where it says I should not do this and Instead use `make` ...