[odb-users] Internal compiler error linked to spdlog

Sean Clarke sean.clarke at sec-consulting.co.uk
Sun May 3 10:00:08 EDT 2020


Hi,
   a few may recall I have had some previous issues with ODB and compiler
seg faults when using Debian 10 or odb 2.5 on anything other than Devian 9
(stretch). I tried compiling teh latest version and in teh end gave up and
removed ODB from that workflow.

Having had some time I have revisited and have identified some sort of
incompatibility between a logging library and its use of fmt.

It is a bit complex and I have had to change a few things to get it down to
a small test set - but essentially if I add some logging in one of the ODB
compiled classes I get an ODB compiler seg fault, remove the logging and it
is all fine (that statement also means the application runs fine, nit just
compiles).

The logline is in a simple accessor:

(include):
//#include <spdlog/spdlog.h>

and accessor statement:
std::shared_ptr<Address> const& address() const {
//    if (m_short_code == "PRIVATE") {
//        auto log = spdlog::get("main");
//        log->error("Customer::address : Customer address of PRIVATE
customer cannot be accessed");
//    }
    return m_address;
}

The logging library is spdlog:
libspdlog-dev - Very fast, header only, C++ logging library

Interestingly the problem was more prominent with the later version that is
packaged in Debian 10 (Buster),

Debian 10 version is 1:1.3.1-1, Debian 9 is 1:0.11.0-2

I do not believe (I may be wrong) that the issue is directly related to the
logging library, I believe this, as I have had a similar seg fault when
using an anonymous function inline in a database class that did nothing
more than string manipulation in the standard library.

Stack trace from the above code looks like:

[  1%] Generating src/types/odb_gen/MyClass-odb.cxx
*** WARNING *** there are active plugins, do not report this as a bug unless
you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_START_UNIT                | odb
PLUGIN_PRAGMAS                   | odb
PLUGIN_OVERRIDE_GATE             | odb
In file included from /usr/include/spdlog/fmt/bundled/format.h:3545:0,
                 from /usr/include/spdlog/fmt/fmt.h:21,
                 from /usr/include/spdlog/common.h:28,
                 from /usr/include/spdlog/spdlog.h:12,
                 from src/types/More_of_my_classes.hpp:3,
                 from src/types/Another_one_of_my_classes.hpp:4,
                 from src/types/MyClass.hpp:3:
/usr/include/spdlog/fmt/bundled/format-inl.h: In function 'int
fmt::v5::{anonymous}::safe_strerror(int, char*&, std::size_t)':
/usr/include/spdlog/fmt/bundled/format-inl.h:99:5: internal compiler error:
Segmentation fault
 int safe_strerror(
     ^~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.

Has anyone else seen anything similar?

Regards
Sean Clarke


More information about the odb-users mailing list