diff --git a/build.zig b/build.zig index 526a31f..5ac0d4f 100644 --- a/build.zig +++ b/build.zig @@ -57,7 +57,7 @@ pub fn build(b: *std.Build) !void { .mode = .simple, }, }); - mod_tests.root_module.link_libc = target.result.os.tag == .freestanding; + mod_tests.root_module.link_libc = target.result.os.tag != .freestanding; test_step.dependOn(&b.addRunArtifact(mod_tests).step); } } diff --git a/lib/build.zig b/lib/build.zig index 77dbd83..f97daba 100644 --- a/lib/build.zig +++ b/lib/build.zig @@ -21,10 +21,12 @@ pub fn build(b: *std.Build) !void { "libtemporal_capi.a"; // --- Module --- // + const is_freestanding = target.result.os.tag == .freestanding; const mod = b.addModule("libtemporal", .{ .root_source_file = b.path("src/root.zig"), .target = target, .optimize = optimize, + .link_libc = !is_freestanding, }); const temporal_rs = b.dependency("temporal_rs", .{ diff --git a/test/build.zig b/test/build.zig index b121d51..6a91165 100644 --- a/test/build.zig +++ b/test/build.zig @@ -15,10 +15,12 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path(if (is_freestanding) "src/wasm.zig" else "src/main.zig"), .target = target, .optimize = optimize, + .link_libc = !is_freestanding, .imports = &.{}, }), }); exe.root_module.addImport("temporalz", temporalz.module("temporalz")); + exe.rdynamic = is_freestanding; b.installArtifact(exe); b.enable_wasmtime = true; // This doesn't work since Zig 0.17.0 release