I wrote a hello world zig file.
const std: type = @import("std");
pub fn main() void {
std.debug.print("{s}\n", .{"Hello World"});
}
[Yes this is the whole file]. When I zig build run
I get this message:
run
└─ run freightdb
└─ zig build-exe freightdb Debug native failure
error: the following command terminated unexpectedly:
/nix/store/n146fdz4qp6flryj8bw8bqly0q8mg18j-zig-0.12.0-dev.3434+e90583f5d/bin/zig build-exe -ODebug --dep ziggy -Mroot=/home/cyrilguiz/.codeberg/freightdb/src/main.zig -fno-strip -ODebug -Mziggy=/home/cyrilguiz/.cache/zig/p/1220037474a924385b0d2ccb0e5c416c595f43f93a3450d55f8b6d5ad6f3ba091ca5/src/root.zig --cache-dir /home/cyrilguiz/.codeberg/freightdb/zig-cache --global-cache-dir /home/cyrilguiz/.cache/zig --name freightdb --listen=-
Build Summary: 0/5 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run freightdb transitive failure
├─ zig build-exe freightdb Debug native failure
└─ install transitive failure
└─ install freightdb transitive failure
└─ zig build-exe freightdb Debug native (reused)
error: the following build command failed with exit code 1:
/home/cyrilguiz/.codeberg/freightdb/zig-cache/o/910c81e0e7016424591fda243bd2ce98/build /nix/store/n146fdz4qp6flryj8bw8bqly0q8mg18j-zig-0.12.0-dev.3434+e90583f5d/bin/zig /home/cyrilguiz/.codeberg/freightdb /home/cyrilguiz/.codeberg/freightdb/zig-cache /home/cyrilguiz/.cache/zig --seed 0x15f25e4e -Z97e6a20565b9ceee run
I don’t know why this happens.
This is the build.zig file:
const std: type = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "freightdb",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
const ziggy = b.dependency("ziggy", .{
.target = target,
.optimize = optimize,
}).module("ziggy");
exe.root_module.addImport("ziggy", ziggy);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}
There are other files in my project to see them visit codeberg