fix(build): disable glog unwind without libunwind#415
Conversation
Use a single libunwind discovery result to keep the bundled glog configuration and its imported target's link dependencies consistent. Co-authored-by: GPT-5.6 Terra <codex@users.noreply.github.com>
|
Additional note from testing: I could not reproduce the unresolved libunwind symbols on macOS, while the issue is reproducible on Linux. This appears to be due to different linker and loader behavior for undefined symbols. When producing a Therefore, a successful macOS build does not make the configuration consistent. When |
There was a problem hiding this comment.
Pull request overview
This PR aligns bundled glog’s unwind configuration with the top-level LIBUNWIND_LIBRARY decision so that explicitly disabling or lacking libunwind doesn’t result in glog being built with unw_* references that downstream linkers can’t satisfy.
Changes:
- Moves
find_library(LIBUNWIND_LIBRARY ...)earlier inbuild_glog()so the result is available duringglog’s CMake configuration. - When
LIBUNWIND_LIBRARYis not found or explicitly disabled (e.g.-DLIBUNWIND_LIBRARY=FALSE), passes-DWITH_UNWIND=noneto bundledglog. - Preserves the existing behavior of adding libunwind to
glog’s imported target link interface when it is available.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zjw1111
left a comment
There was a problem hiding this comment.
Thanks for the follow-up! The fix is well-reasoned: making both glog's WITH_UNWIND setting and paimon's link propagation derive from the same LIBUNWIND_LIBRARY result resolves the unresolved unw_* symbols cleanly, and -DWITH_UNWIND=none is a valid driver value for glog v0.7.1. +1
Purpose
Linked issue: N/A
This is a follow-up to #60. That change fixed static-link errors in regular configurations by adding a discovered libunwind library to the imported
glogtarget's link interface. However, it made that decision after bundled glog had already been configured, so an explicitLIBUNWIND_LIBRARY=FALSEsetting was not propagated to glog.A downstream build can explicitly set
-DLIBUNWIND_LIBRARY=FALSEto prevent paimon-cpp from using or propagating libunwind. Before this change, paimon-cpp skipped adding libunwind to the importedglogtarget, but glog still used its default unwind auto-detection. When libunwind was installed and discoverable by glog's CMake configuration, glog enabled libunwind support and compiled stacktrace code withunw_*references.The inconsistency becomes visible when a downstream application links the resulting static glog library: paimon-cpp does not propagate
-lunwind, while glog contains calls that require it, which can produce unresolvedunw_*symbols. Downstream users must then carry a glog-specific patch or otherwise override glog's unwind configuration.Use the same
LIBUNWIND_LIBRARYresult for both decisions. When libunwind is unavailable or explicitly disabled, pass-DWITH_UNWIND=noneto bundled glog and omit the libunwind link dependency. Otherwise, retain the existing automatic discovery and linking behavior.Tests
cmake --build build --target glog_ep -j 4pre-commit run --files cmake_modules/ThirdpartyToolchain.cmakegit diff --checkAPI and Format
No public API, storage format, or protocol changes.
Documentation
No documentation changes.
Generative AI tooling
Generated-by: Codex GPT-5.6 Terra