fix: disable libunwind in glog#383
Merged
Merged
Conversation
Changed glog build configuration to create a shared library instead of a static library for proper dependency management.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the third-party glog build configuration to build glog as a shared library, aiming to improve runtime dependency behavior (notably around libunwind) and avoid leaking glog’s private dependencies into libneug.so.
Changes:
- Switch glog from static to shared library build.
- Add rationale comments explaining why shared glog is required for correct dependency/symbol resolution behavior.
Comments suppressed due to low confidence (1)
cmake/BuildGlogAsThirdParty.cmake:32
- Changing
BUILD_SHARED_LIBSin this helper can leak into subsequentadd_subdirectory(...)calls and unintentionally flip other third-party builds to shared. Other helpers in this repo (e.g., protobuf) explicitly save/restore or unsetBUILD_SHARED_LIBSafter building the dependency; consider doing the same here to keep the change scoped to glog.
set(BUILD_SHARED_LIBS ON)
add_subdirectory(third_party/glog)
include_directories(third_party/glog/src)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/glog/) # For generated headers
set_target_properties(glog PROPERTIES DEBUG_POSTFIX "")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
libunwind.a and its dependency liblzma.a when building glog
Removed linker options for libunwind and liblzma.
libunwind.a and its dependency liblzma.a when building glogglog
Removed unnecessary glog module directory settings and dependency on Unwind.
Comment on lines
+23
to
+29
| # Disable libunwind in glog to prevent _Unwind_* symbol conflict with | ||
| # libgcc_s.so.1. When both libunwind.so.8 and libgcc_s.so.1 are loaded, | ||
| # the dynamic linker may resolve _Unwind_RaiseException to libunwind's | ||
| # version which cannot dispatch C++ exceptions, causing abort() instead | ||
| # of reaching catch blocks. With WITH_UNWIND=OFF, glog falls back to | ||
| # _Unwind_Backtrace from <unwind.h> (provided by libgcc_s) for stack | ||
| # traces in LOG(FATAL) / signal handlers — same quality, no conflict. |
Member
|
From my point of view, it is ok to disable libunwind, since we don't really rely on the embedding stack trace printing from libunwind. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the
build_glog_as_third_partyfunction in thecmake/BuildGlogAsThirdParty.cmakefile to address a symbol conflict issue betweenlibunwindandlibgcc_swhen building glog as a third-party dependency. The most significant change is the explicit disabling oflibunwindsupport in glog to prevent runtime errors related to exception handling.Dependency build configuration:
set(WITH_UNWIND OFF ...)to disablelibunwindwhen building glog, preventing symbol conflicts withlibgcc_sthat could cause C++ exceptions to abort instead of being caught. This ensures reliable stack traces without introducing symbol resolution issues.