From 90d19b10628524d6d0e58e7b790c9348188f062d Mon Sep 17 00:00:00 2001 From: Socrates Date: Sun, 14 Jun 2026 01:43:06 +0800 Subject: [PATCH] fix: isolate external projects from host toolchain library paths Add -DCMAKE_LIBRARY_PATH= and -DCMAKE_PREFIX_PATH= to EP_COMMON_CMAKE_ARGS to prevent external projects (Arrow, ORC, etc.) from finding incompatible libraries from non-system toolchains. Problem ------- On a Fedora machine with a non-system LLVM toolchain (ldb_toolchain) on PATH, cmake derives implicit library search paths from the compiler location. This caused Arrow's bundled dependency build to find libunwind.so from the toolchain at /home/socrates/ldb_toolchain/lib/, which lacks the _Unwind_RaiseException symbol (actually provided by libgcc_s). At test runtime this produced: symbol lookup error: undefined symbol: _Unwind_RaiseException This does not reproduce in CI (GitHub Actions Ubuntu runners) because CI images have no such toolchain and no unversioned libunwind.so. Fix ---- Block CMAKE_LIBRARY_PATH and CMAKE_PREFIX_PATH in EP_COMMON_CMAKE_ARGS, which are passed to every external project's cmake configure step. All external project dependencies are already passed explicitly via xxx_ROOT/xxx_HOME/xxx_DIR variables, so clearing these search paths is safe. This is a subtask of #260 (cmake infrastructure improvements). Co-Authored-By: Claude Fable 5 --- cmake_modules/ThirdpartyToolchain.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake index 271011a0d..fcf869a92 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake @@ -377,7 +377,14 @@ set(EP_COMMON_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS} -DCMAKE_C_FLAGS=${EP_C_FLAGS} - -DCMAKE_INSTALL_LIBDIR=lib) + -DCMAKE_INSTALL_LIBDIR=lib + # Prevent leaking host toolchain library/include paths into external + # project builds. Without these, cmake may find incompatible libraries + # (e.g. a partial libunwind.so from a toolchain) that cause runtime + # symbol lookup errors. All external project dependencies are passed + # explicitly via xxx_ROOT/xxx_HOME variables. + -DCMAKE_LIBRARY_PATH= + -DCMAKE_PREFIX_PATH=) if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30") list(APPEND EP_COMMON_CMAKE_ARGS -DCMAKE_POLICY_VERSION_MINIMUM=3.5)