From 5667a6d7bd8c3c6a0d4327cee74905b7fe85a853 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Wed, 25 Mar 2026 19:06:46 -0700 Subject: [PATCH] Fix Linux build: default static linking off, add Clang link flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KTE_STATIC_LINK defaulted to ON, which fails on systems where ncurses is only available as a shared library. The Nix build already passed -DKTE_STATIC_LINK=OFF explicitly; this makes the default match. Also add add_link_options("-stdlib=libc++") for Clang builds — without it, compilation uses libc++ but the linker defaults to libstdc++, causing undefined symbol errors. Co-Authored-By: Claude Opus 4.6 (1M context) --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c255c7..92b4932 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ set(BUILD_TESTS ON CACHE BOOL "Enable building test programs.") set(KTE_FONT_SIZE "18.0" CACHE STRING "Default font size for GUI") option(KTE_UNDO_DEBUG "Enable undo instrumentation logs" OFF) option(KTE_ENABLE_TREESITTER "Enable optional Tree-sitter highlighter adapter" OFF) -option(KTE_STATIC_LINK "Enable static linking on Linux" ON) +option(KTE_STATIC_LINK "Enable static linking on Linux" OFF) # Optionally enable AddressSanitizer (ASan) option(ENABLE_ASAN "Enable AddressSanitizer for builds" OFF) @@ -51,6 +51,7 @@ else () ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") add_compile_options("-stdlib=libc++") + add_link_options("-stdlib=libc++") else () # nothing special for gcc at the moment endif ()