From 5fd36ea69e1d69f0ae15424d736a30df7b07fc81 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 21 Mar 2026 15:15:11 -0700 Subject: [PATCH] build: enable PIC for static libghostty-vt The static library was built without position-independent code, which caused linker errors when consumers tried to link it into PIE executables (the default on most Linux distributions). The linker would fail with "relocation R_X86_64_32 against symbol cannot be used when making a PIE object." Enable PIC on the static library root module so it can be linked into both PIE and non-PIE executables. --- src/build/GhosttyLibVt.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/build/GhosttyLibVt.zig b/src/build/GhosttyLibVt.zig index ba3881496..1f5f72b84 100644 --- a/src/build/GhosttyLibVt.zig +++ b/src/build/GhosttyLibVt.zig @@ -100,6 +100,10 @@ fn initLib( // we'll cross that bridge when we get to it. lib.bundle_compiler_rt = true; lib.bundle_ubsan_rt = true; + + // Enable PIC so the static library can be linked into PIE + // executables, which is the default on most Linux distributions. + lib.root_module.pic = true; } if (lib.rootModuleTarget().abi.isAndroid()) {