Motivation: my source files are on a network (samba) share.
zig build
fails with
error: Unexpected
. To overcome it (otherwise I have to delete the ./zig-cache/ folder before every build) and to save time (and potentially the SSD drive) I want to use RAMdrive for the local cache. I modified my build.zig like this:
const std=@import("std");
const Builder=@import("std").build.Builder;
pub fn build(b:*Builder) void {
b.cache_root=.{.path="I:/my_build_cache",.handle=std.fs.openDirAbsolute("I:/",.{}) catch unreachable};
const target=b.standardTargetOptions(.{});
[...]
where I:/ is my RAMdrive. It kind of works (one time), but does not solve my problem, because zig still creates the ./zig-cache/ folder to build the build.exe which then uses I:/my_build_cache for the other artifacts. For context, this is on Windows, but a solution for Linux is equally welcome. Can I set up some environment variables to influence zig.exe earlier in the build process or (worst case) give it some command-line argument to specify the local cache directory?
Specify ZIG_LOCAL_CACHE_DIR
to set other directory for local cache
https://wiki.gentoo.org/wiki/Zig#Environment_variables
Answer provided by BratishkaErik on https://t.me/ziglang_en