From 67f369484cbba0be0c6dcb9b73cf7f872a25baf7 Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Sat, 8 Apr 2023 09:51:07 +0200 Subject: [PATCH] build: ensure the exercise links libc, when needed When running, as an example, `zig build -Dhealed -Dn=93 test`, the build fails, because the `test` step use the standard CompileStep, instead of ZiglingStep. Ensure that exercises using libc are correctly built. Closes #229 --- build.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.zig b/build.zig index 6a0bcb8..ca76dab 100644 --- a/build.zig +++ b/build.zig @@ -560,6 +560,9 @@ pub fn build(b: *Build) !void { }) catch unreachable; const build_step = b.addExecutable(.{ .name = base_name, .root_source_file = .{ .path = file_path } }); + if (ex.C) { + build_step.linkLibC(); + } build_step.install(); const run_step = build_step.run();