diff --git a/src/build/GhosttyLibVt.zig b/src/build/GhosttyLibVt.zig index 1f5f72b84..a574bbf0c 100644 --- a/src/build/GhosttyLibVt.zig +++ b/src/build/GhosttyLibVt.zig @@ -94,12 +94,19 @@ fn initLib( ); if (kind == .static) { + const is_msvc_abi = target.result.abi == .msvc; + // These must be bundled since we're compiling into a static lib. // Otherwise, you get undefined symbol errors. This could cause // problems if you're linking multiple static Zig libraries but // we'll cross that bridge when we get to it. - lib.bundle_compiler_rt = true; - lib.bundle_ubsan_rt = true; + // + // On MSVC targets, the MSVC runtime provides these, and Zig's + // bundled versions produce object files with ELF-style linker + // directives (e.g. /exclude-symbols) and COMDAT sections that + // are incompatible with the MSVC linker (LNK1143, LNK4229). + lib.bundle_compiler_rt = !is_msvc_abi; + lib.bundle_ubsan_rt = !is_msvc_abi; // Enable PIC so the static library can be linked into PIE // executables, which is the default on most Linux distributions.