Skip to content

Commit 5f0d0fa

Browse files
committed
fix linking llvm to prefer static libs for things bundled by roc-bootstrap
1 parent 346de8a commit 5f0d0fa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

build.zig

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,20 @@ fn addStaticLlvmOptionsToModule(mod: *std.Build.Module) !void {
369369
.flags = &cpp_cflags,
370370
});
371371

372+
const link_static = std.Build.Module.LinkSystemLibraryOptions{
373+
.preferred_link_mode = .static,
374+
.search_strategy = .mode_first,
375+
};
372376
for (lld_libs) |lib_name| {
373-
mod.linkSystemLibrary(lib_name, .{});
377+
mod.linkSystemLibrary(lib_name, link_static);
374378
}
375379

376380
for (llvm_libs) |lib_name| {
377-
mod.linkSystemLibrary(lib_name, .{});
381+
mod.linkSystemLibrary(lib_name, link_static);
378382
}
379383

380-
mod.linkSystemLibrary("z", .{});
381-
mod.linkSystemLibrary("zstd", .{});
384+
mod.linkSystemLibrary("z", link_static);
385+
mod.linkSystemLibrary("zstd", link_static);
382386

383387
if (mod.resolved_target.?.result.os.tag != .windows or mod.resolved_target.?.result.abi != .msvc) {
384388
// TODO: Can this just be `mod.link_libcpp = true`? Does that make a difference?

0 commit comments

Comments
 (0)