libghostty: Remove all libc++ and libc++ ABI dependencies

This updates simdutf to my fork which has a SIMDUTF_NO_LIBCXX option
that removes all libc++ and libc++ ABI dependencies. 

From there, the hand-written simd code we have has been updated to also
no longer use any libc++ features. Part of this required removing utfcpp
since it depended on libc++ (`<iterator>`).

libghostty-vt now only depends on libc.
This commit is contained in:
Mitchell Hashimoto
2026-04-14 20:40:05 -07:00
parent efa8da6aea
commit e51de8b58f
25 changed files with 48248 additions and 33886 deletions

View File

@@ -3,6 +3,7 @@ const std = @import("std");
pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const no_libcxx = b.option(bool, "no_libcxx", "Set SIMDUTF_NO_LIBCXX to avoid libc++ dependency") orelse false;
const lib = b.addLibrary(.{
.name = "simdutf",
@@ -13,13 +14,15 @@ pub fn build(b: *std.Build) !void {
.linkage = .static,
});
lib.linkLibC();
// On MSVC, we must not use linkLibCpp because Zig unconditionally
// passes -nostdinc++ and then adds its bundled libc++/libc++abi
// include paths, which conflict with MSVC's own C++ runtime headers.
// The MSVC SDK include directories (added via linkLibC) contain
// both C and C++ headers, so linkLibCpp is not needed.
if (target.result.abi != .msvc) {
lib.linkLibCpp();
if (!no_libcxx) {
// On MSVC, we must not use linkLibCpp because Zig unconditionally
// passes -nostdinc++ and then adds its bundled libc++/libc++abi
// include paths, which conflict with MSVC's own C++ runtime headers.
// The MSVC SDK include directories (added via linkLibC) contain
// both C and C++ headers, so linkLibCpp is not needed.
if (target.result.abi != .msvc) {
lib.linkLibCpp();
}
}
lib.addIncludePath(b.path("vendor"));
@@ -45,6 +48,13 @@ pub fn build(b: *std.Build) !void {
"-fno-sanitize-trap=undefined",
});
if (no_libcxx) {
try flags.append(b.allocator, "-DSIMDUTF_NO_LIBCXX");
try flags.append(b.allocator, "-fno-exceptions");
try flags.append(b.allocator, "-fno-rtti");
lib.root_module.addCMacro("SIMDUTF_NO_LIBCXX", "1");
}
if (target.result.os.tag == .freebsd or target.result.abi == .musl) {
try flags.append(b.allocator, "-fPIC");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff