Skip to content

Replace boost::log with std::mutex and std::ofstream#111

Merged
wdolinar merged 2 commits intomasterfrom
fix_logging_in_python
Mar 24, 2026
Merged

Replace boost::log with std::mutex and std::ofstream#111
wdolinar merged 2 commits intomasterfrom
fix_logging_in_python

Conversation

@wdolinar
Copy link
Copy Markdown
Member

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.

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.
@wdolinar wdolinar merged commit 7bcf058 into master Mar 24, 2026
14 checks passed
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.

1 participant