From b4b0aac7dacfe3a16d67653823e1ae82fa5a62c1 Mon Sep 17 00:00:00 2001 From: "Nurul Huda (Apon)" Date: Thu, 16 Jul 2026 07:07:12 +0600 Subject: [PATCH] fix: missed linking libc --- build.zig | 2 +- lib/build.zig | 2 ++ test/build.zig | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) 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