Open
Description
We are encountering failures with gcc-14 when attempting to use MDC with SPDLOG_COMPILED_LIB (spdlog-1.14.1, unable to test with newer since we are stuck on fmt-10).
The following testing code is use:
#include "spdlog/spdlog.h"
#include "spdlog/mdc.h"
int main(int, char **) {
spdlog::set_pattern("[%&] %v");
spdlog::mdc::put("key", "value");
spdlog::info("Some log message with context");
}
This compiled with gcc-14.2.0 (in Ubuntu 25.04):
/usr/bin/g++ -DFMT_SHARED -DSPDLOG_FMT_EXTERNAL -DSPDLOG_COMPILED_LIB -DSPDLOG_SHARED_LIB -isystem /opt/local/include example.cpp -o example /opt/local/lib/libspdlog.so.1.14.1 /opt/local/lib/libfmt.so.10.2.1
(This is what a CMake project does essentially, without any additional compiler flags, but details have been stripped for this minimal reproducer.)
We can also compile this with:
/usr/bin/g++ -DFMT_SHARED -DSPDLOG_FMT_EXTERNAL -isystem /opt/local/include example.cpp -o example /opt/local/lib/libfmt.so.10.2.1
In the first case (SPDLOG_COMPILED_LIB
), the invocation of ./example
results in:
[] Some log message with context
In the second case (no SPDLOG_COMPILED_LIB
), the invocation of ./example
results in:
[key:value] Some log message with context
This behavior is compiler-dependent. clang++
(21.0.0, development snapshot) works in the case of SPDLOG_COMPILED_LIB
.
Metadata
Metadata
Assignees
Labels
No labels