From c5bb97bcbda89ffb9e715a41727dcd61bdd70dd3 Mon Sep 17 00:00:00 2001 From: Alessandro De Blasis Date: Wed, 25 Mar 2026 06:21:15 +0100 Subject: [PATCH] build: fix libghostty shared lib install for Windows On Windows, install as ghostty.dll + ghostty-static.lib instead of libghostty.so + libghostty.a, following Windows naming conventions. Guard ubsan_rt bundling in initStatic for MSVC compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) --- build.zig | 9 +++++++-- src/build/GhosttyLib.zig | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 1f3d0c196..9362eeb59 100644 --- a/build.zig +++ b/build.zig @@ -152,8 +152,13 @@ pub fn build(b: *std.Build) !void { // build on macOS this way ironically so we need to fix that. if (!config.target.result.os.tag.isDarwin()) { lib_shared.installHeader(); // Only need one header - lib_shared.install("libghostty.so"); - lib_static.install("libghostty.a"); + if (config.target.result.os.tag == .windows) { + lib_shared.install("ghostty.dll"); + lib_static.install("ghostty-static.lib"); + } else { + lib_shared.install("libghostty.so"); + lib_static.install("libghostty.a"); + } } } diff --git a/src/build/GhosttyLib.zig b/src/build/GhosttyLib.zig index 2ac383544..9ec9147fa 100644 --- a/src/build/GhosttyLib.zig +++ b/src/build/GhosttyLib.zig @@ -39,6 +39,12 @@ pub fn initStatic( lib.bundle_compiler_rt = true; lib.bundle_ubsan_rt = true; + if (deps.config.target.result.os.tag == .windows) { + // Zig's ubsan emits /exclude-symbols linker directives that + // are incompatible with the MSVC linker (LNK4229). + lib.bundle_ubsan_rt = false; + } + // Add our dependencies. Get the list of all static deps so we can // build a combined archive if necessary. var lib_list = try deps.add(lib);