Skip to content

fix: isolate external projects from host toolchain library paths#367

Open
suxiaogang223 wants to merge 1 commit into
alibaba:mainfrom
suxiaogang223:codex/fix-libunwind-link
Open

fix: isolate external projects from host toolchain library paths#367
suxiaogang223 wants to merge 1 commit into
alibaba:mainfrom
suxiaogang223:codex/fix-libunwind-link

Conversation

@suxiaogang223

@suxiaogang223 suxiaogang223 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Problem

When building paimon-cpp on a Fedora machine with a non-system LLVM toolchain (ldb_toolchain) on PATH, all tests crash with:

symbol lookup error: undefined symbol: _Unwind_RaiseException

Root cause: cmake derives implicit library search paths from the compiler location. When ldb_toolchain is on PATH, Arrow find_library(unwind) finds libunwind.so under the toolchain directory. However, this toolchain-provided libunwind lacks the _Unwind_RaiseException symbol, which is actually provided by libgcc_s.so.1.

Why CI passes: GitHub Actions Ubuntu runners have no non-system toolchain and no unversioned libunwind.so (only libunwind.so.8). Arrow cannot find libunwind, falls back to libgcc_s, and works correctly.

Fix

Add -DCMAKE_LIBRARY_PATH= and -DCMAKE_PREFIX_PATH= to EP_COMMON_CMAKE_ARGS, which are passed to every external project cmake configure step. This blocks host toolchain library paths from leaking into external project builds (Arrow, ORC, etc.).

All external project dependencies are already passed explicitly via xxx_ROOT/xxx_HOME/xxx_DIR variables, so clearing these search paths is safe.

Files Changed

cmake_modules/ThirdpartyToolchain.cmake | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Verification

Fedora x86_64, GCC 16 + ldb_toolchain:

  • ldd paimon-core-test shows no libunwind dependency
  • 38/42 tests pass (4 failures are pre-existing test data issues)
  • No more _Unwind_RaiseException crash

🤖 Generated with Claude Code

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 alibaba#260 (cmake infrastructure improvements).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment on lines 1853 to 1856
find_library(LIBUNWIND_LIBRARY NAMES unwind)
if(LIBUNWIND_LIBRARY)
target_link_libraries(glog INTERFACE ${LIBUNWIND_LIBRARY})
endif()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won’t glog also report an error about _Unwind_RaiseException?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants