Building zig from source code using zig-bootstrap'ed zig

I’d like to do some changes to the standard library. However, I have a hard time understanding how to build Zig from source code.

In order to avoid having to build LLVM myself, I downloaded zig-bootstrap and built that.

I’m stuggling to understand how to build another version using the binary from zig-bootstrap.

I was trying to follow the wiki instructions:

$path_to_zig_bootstrap/out/zig-x86_64-linux-gnu-baseline/zig build -p stage3 --search-prefix "$path_to_zig_bootstrap/out/x86_64-linux-gnu-baseline" --zig-lib-dir lib -Dstatic-llvm

I’m getting errors:

error: sub-compilation of compiler_rt failed                                                                                                                                 
    /home/lukas/projects/zig/zig/lib/compiler_rt/absvdi2.zig:10:36: note: calling convention 'x86_64_regcall_v3_sysv' not supported by compiler backend 'stage2_llvm'        
pub fn __absvdi2(a: i64) callconv(.c) i64 {                                                                                                                                  

So I’m obviously doing something wrong.

Are there an up-to-date instructions how to use zig-bootstrap to build another version of zig?

You don’t need to build Zig from source if you just want to change the standard library, you can directly edit the standard library.


I haven’t tried zig-bootstrap, but last time I built Zig I used this and it worked well (just took a long time on my slow laptop):

I guess you would have to update the llvm version numbers.

I can’t run tests, because std in master depends on a different language version. I’ll have a look at the thread, thank you.