Hello everyone,
I work on a Linux application based on C++ & Qt and I try to properly build mongocxx and link to it. Everything works smoothly, but the app crashes on launch. Here is the stack trace:
Program received signal SIGSEGV, Segmentation fault.
0x0000555555d6d070 in bson_free ()
(gdb) where
#0 0x0000555555d6d070 in bson_free ()
#1 0x00007ffff3f21b63 in bson_string_free (string=0x555555e4d320, free_segment=free_segment@entry=false)
at /home/lukasz/qliqsoft/mongo-c-driver/src/libbson/src/bson/bson-string.c:101
#2 0x00007ffff3f9086b in _set_platform_string (handshake=0x7ffff3ff7780 <gMongocHandshake>)
at /home/lukasz/qliqsoft/mongo-c-driver/src/libmongoc/src/mongoc/mongoc-handshake.c:378
#3 _mongoc_handshake_init () at /home/lukasz/qliqsoft/mongo-c-driver/src/libmongoc/src/mongoc/mongoc-handshake.c:442
#4 0x00007ffff3f8ae33 in _mongoc_do_init () at /home/lukasz/qliqsoft/mongo-c-driver/src/libmongoc/src/mongoc/mongoc-init.c:140
#5 0x00007ffff456547f in __pthread_once_slow (once_control=0x7ffff3ff7734 <once>, init_routine=0x7ffff3f8adf0 <_mongoc_do_init>)
at pthread_once.c:116
#6 0x00007ffff6c6cb7b in std::unique_ptr<mongocxx::v_noabi::instance::impl, std::default_delete<mongocxx::v_noabi::instance::impl> > core::v1::make_unique<mongocxx::v_noabi::instance::impl, void, std::unique_ptr<mongocxx::v_noabi::logger, std::default_delete<mongocxx::v_noabi::logger> > >(std::unique_ptr<mongocxx::v_noabi::logger, std::default_delete<mongocxx::v_noabi::logger> >&&) () from /lib/x86_64-linux-gnu/libmongocxx.so._noabi
#7 0x00007ffff6c6c8fd in mongocxx::v_noabi::instance::instance(std::unique_ptr<mongocxx::v_noabi::logger, std::default_delete<mongocxx::v_noabi::logger> >) () from /lib/x86_64-linux-gnu/libmongocxx.so._noabi
#8 0x00007ffff6c6c9d9 in mongocxx::v_noabi::instance::instance() () from /lib/x86_64-linux-gnu/libmongocxx.so._noabi
#9 0x000055555578b47f in main (argc=1, argv=0x7fffffffde88) at ../qliqdesktop/src/qliqstor/service/main.cpp:37
(gdb) quit
A debugging session is active.
So creating an mongocxx::instance variable is the very first thing that application does, but I get segmentation fault. I think that it is something related to mongocxx dependencies, so how I actually build the library?
I needed mongoc, so I cloned the official repository, built it, and installed using official guideline. I used version from r1.17 branch. I could install from Ubuntu repository, but that version is 1.16 and the newest mongocxx requires at least 1.17.
So that worked and I cloned mongocxx repository from releases/stable branch, built it and installed. Everything using commands from official guideline.
App builds without problems, ldd sees mongocxx and bsoncxx, but I get that segmentation fault. Do you have any ideas how to solve this issue?
