I randomly get build error of
error: no field named 'path' in union 'Build.LazyPath'
.root_source_file = .{ .path = "src/hello.zig" },
^~~~
/.zvm/0.13.0/lib/std/Build.zig:2171:22: note: union declared here
pub const LazyPath = union(enum) {
^~~~~
My current build script
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "zigzag",
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
// This declares intent for the library to be installed into the standard
// location when the user invokes the "install" step (the default step when
// running `zig build`).
b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "zigzag",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
// test
const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};
const exe_unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/hello.zig" },
.target = target,
.optimize = optimize,
.filters = test_filters,
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
const test_step = b.step("testx", "Run unit tests");
test_step.dependOn(&run_exe_unit_tests.step);
// Runnes
// const run_exe = b.addRunArtifact(exe);
// const run_step = b.step("runx", "Runx the application");
// run_step.dependOn(&run_exe.step);
}
sometimes it goes away when I comment out some part of the script and sometimes it does not unless I reset to the default and then revert back to the version I shared.
Any ideas what is going on?