mongocxx driver 3.0.2 - Runtime error

1,187 views
Skip to first unread message

Claudio Palumbo

unread,
Nov 8, 2016, 11:53:59 PM11/8/16
to mongodb-user
Hi, I just installed the new cxx driver to update a project since it is currently using the legacy driver. 

However, I'm getting a run-time error when trying to run the example test code provided in the installation guide ( https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ ).

OS - Ubuntu 16.04LTS -> fresh install


I have tried compiling both with and without pkgconfig but same error.

Compile commands tried:

c++ --std=c++11 test.cpp -o test $(pkg-config --cflags --libs libmongocxx)

c++ --std=c++11 test.cpp -o test -I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/bsoncxx/v_noabi -I/usr/local/include/libbson-1.0 -L/usr/local/lib -lmongocxx -lbsoncxx

(I also tried g++ both with and without pkgconfig)


It compiles fine but get a runtime error of :

     "error while loading shared libraries: libmongocxx.so._noabi: cannot open shared object file: No such file or directory"


Since it compiled without any errors and I checked the usr/local/ folders and libmongocxx.so._noabi is there I'm at a loss as to what is causing this error.

If anyone could help me out that would be great. If not, a more tested version of linux? Like I said I'm at a bit of a loss.


Thanks.

Claudio

David Golden

unread,
Nov 9, 2016, 1:01:36 PM11/9/16
to mongodb-user
Hi.  Can you post your exact installation commands and the output you got?  Also what is the output of the pkg-config stanza run by itself?

Thanks,
David

Claudio Palumbo

unread,
Nov 9, 2016, 3:33:36 PM11/9/16
to mongodb-user
Hi David, thanks for the reply.

I followed the installation commands provided in the installation guide. The only change is that I had to run 'sudo cmake ...' and 'sudo make' before running before 'sudo make install' since I was getting permission errors with cmake on its own. 

So to specify:

"sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .."
"sudo make EP_mnmlstc_core"
then "sudo make && sudo make install"

It was a little odd than I needed to run sudo with cmake to get it to work but assumed that had to do with /usr/local requiring root permissions.

Running pkg-config --cflags libmongocxx returns -I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libmongoc-1/0 -I/usr/local/include/bsoncxx/v_noabi -I/user/local/include/libbson-1.0

pkg-config --libs libmongocxx returns -L/usr/local/lib -lmongocxx lbsoncxx

As far as I can tell that is correct and as I said it compiles fine. Hopefully you can make more sense of what's going on since I'm at a loss right now.

Thanks,
Claudio

Claudio Palumbo

unread,
Nov 9, 2016, 3:55:28 PM11/9/16
to mongodb-user
Hey David,

So I was able to resolve the issue. Turns out I didn't have to do anything. I had a "moment" and thought the problem may be with Ubuntu so ran apt-get upgrade and there were updates for the cpp, g++ and gcc compilers. I recompiled the test code and it ran fine. 

Now to setup eclipse to work decently with c++ once again. lol

Thanks again for your help.

Claudio

On Wednesday, November 9, 2016 at 1:01:36 PM UTC-5, David Golden wrote:

David Golden

unread,
Nov 9, 2016, 5:01:23 PM11/9/16
to mongodb-user
Glad to hear you got it figured out!

Matias Roldan

unread,
Aug 5, 2019, 5:21:31 AM8/5/19
to mongodb-user
I've fixed adding 'libbsoncxx.so._noabi' path to LD_LIBRARY_PATH env var with:
$ locate libbsoncxx.so._noabi
/usr/local/lib/lib/libbsoncxx.so._noabi
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/lib
Reply all
Reply to author
Forward
0 new messages