Replace boost::log with std::mutex and std::ofstream#111
Merged
Conversation
boost::log uses global singletons and function-local statics that break when the library is compiled into a pybind shared library with GCC LTO enabled (-flto=auto). The new GCC 13 / Python 3.13 Docker image injects LTO flags via Python's sysconfig, causing boost::log's internal state to be null when accessed from the .so. Any XM_LOG call then segfaults (crash at address 0x20 through boost::log::core). The replacement uses std::mutex for thread safety and std::ofstream for file output. The log format, public API, and message stacking behavior are unchanged.
The iProcessName() function uses MAX_PATH, DWORD, and GetModuleFileNameA which require windows.h on MSVC builds.
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.
boost::log uses global singletons and function-local statics that break when the library is compiled into a pybind shared library with GCC LTO enabled (-flto=auto). The new GCC 13 / Python 3.13 Docker image injects LTO flags via Python's sysconfig, causing boost::log's internal state to be null when accessed from the .so. Any XM_LOG call then segfaults (crash at address 0x20 through boost::log::core).
The replacement uses std::mutex for thread safety and std::ofstream for file output. The log format, public API, and message stacking behavior are unchanged.