Fix yaml-cpp exception symbol visibility#592
Merged
Merged
Conversation
…13BadConversionE)
Two complementary fixes for the intermittent runtime error:
1. Set CXX_VISIBILITY_PRESET=default and VISIBILITY_INLINES_HIDDEN=FALSE on
the yaml-cpp CMake target (contrib/yaml-cpp-0.6.2/CMakeLists.txt). GAMBIT
enables CMAKE_CXX_VISIBILITY_PRESET=hidden globally by default (when no
-rdynamic is in CMAKE_CXX_FLAGS), which would otherwise hide yaml-cpp
exception RTTI even though YAML_CPP_API correctly applies
__attribute__((visibility("default"))) to each exception class.
2. Set ENABLE_EXPORTS=TRUE on all GAMBIT executables (cmake/utilities.cmake).
This adds -rdynamic (Linux) / -export_dynamic (macOS) to the executable
link step, so yaml-cpp typeinfo symbols that are statically linked into the
executable are exported into the dynamic symbol table and remain resolvable
by backends and scanner plugins loaded at runtime via dlopen.
The error is intermittent because it only manifests when a user builds without
-rdynamic in CMAKE_CXX_FLAGS (the default), and when a dlopen'd backend or
plugin references yaml-cpp exception typeinfo that is not otherwise visible.
https://claude.ai/code/session_01PAuG5z7cdvGWuxbpWMn52L
Documents why ENABLE_EXPORTS is set via a target property rather than CMAKE_CXX_FLAGS, how it interacts with the project-wide hidden visibility preset to keep GAMBIT internals unexported, and the symbol interposition behaviour to be aware of for third-party backends. https://claude.ai/code/session_01PAuG5z7cdvGWuxbpWMn52L
anderkve
approved these changes
May 8, 2026
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 PR fixes an intermittent runtime error where backends or scanner plugins loaded via dlopen cannot resolve the RTTI typeinfo for YAML::BadConversion (and related exception classes).
Root cause: Two interacting gaps in the build system:
The error is intermittent because it only manifests on builds where the user has not manually added -rdynamic to CMAKE_CXX_FLAGS.
Changes:
Verified by confirming _ZTIN4YAML13BadConversionE appears in nm -D gambit after the fix (previously absent), and that the scanner plugin shared libraries (e.g. libscanner_multinest_3.12.so) which reference this symbol as an undefined import can now resolve it at load time.