[CXX-990] Can't install the C++ driver Created: 11/Aug/16  Updated: 11/Sep/19  Resolved: 11/Aug/16

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: 3.0.1
Fix Version/s: None

Type: Task Priority: Blocker - P1
Reporter: kapil gupta Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 14.04
GCC 4.8.5



 Description   

I have installed libbson and C mongodb driver. I then tried to install the C++ new driver which gave me this error:

```
CMake Error at /home/cortana/Desktop/mongo-cxx-driver-master/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-Release.cmake:16 (message):
Command failed: 2

'make' 'install'

See also

/home/cortana/Desktop/mongo-cxx-driver-master/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log

make[2]: *** [src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install] Error 1
make[1]: *** [src/bsoncxx/third_party/CMakeFiles/EP_mnmlstc_core.dir/all] Error 2
make: *** [all] Error 2
```
How do I remove this error and install the driver?



 Comments   
Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

Unfortunately, pkg-config just doesn't seem to want you to be able to set rpath via the pkg-config system, or I would recommend that. I'm not sure if using the CMake modules we ship would solve the problem either, but it might. In any event, in the real world you will be building against the C++11 library with a build system of some sort, which can automate this for you.

I'm going to close this ticket as 'works as designed' because I don't think there are any changes to make here.

Comment by kapil gupta [ 11/Aug/16 ]

ok, sorry about that :/ Is there a more permanent solution than mentioning rpath on each compilation ?

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

Right, so /usr/local/lib is in fact not in your default runtime library search path. When you link to libmongocxx or libbsoncxx, you need to specify it with -Wl,-rpath,/usr/local/lib as I originally suggested.

Comment by kapil gupta [ 11/Aug/16 ]

Now it works

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

And what happens if you run

LD_LIBRARY_PATH=/usr/local/lib ./hellomongo

Comment by kapil gupta [ 11/Aug/16 ]

rw-rr- 1 root root 293190 Aug 11 19:02 /usr/local/lib/libbsoncxx.a
lrwxrwxrwx 1 root root 20 Aug 11 19:07 /usr/local/lib/libbsoncxx.so -> libbsoncxx.so._noabi
rw-rr- 1 root root 189362 Aug 11 19:02 /usr/local/lib/libbsoncxx.so.3.0.2-rc0-pre
lrwxrwxrwx 1 root root 27 Aug 11 19:07 /usr/local/lib/libbsoncxx.so._noabi -> libbsoncxx.so.3.0.2-rc0-pre
rw-rr- 1 root root 612522 Aug 11 19:05 /usr/local/lib/libmongocxx.a
lrwxrwxrwx 1 root root 21 Aug 11 19:07 /usr/local/lib/libmongocxx.so -> libmongocxx.so._noabi
rw-rr- 1 root root 343051 Aug 11 19:03 /usr/local/lib/libmongocxx.so.3.0.2-rc0-pre
lrwxrwxrwx 1 root root 28 Aug 11 19:07 /usr/local/lib/libmongocxx.so._noabi -> libmongocxx.so.3.0.2-rc0-pre

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

And, lastly, what does

 ls -la /usr/local/lib/libbsoncxx* /usr/local/lib/libmongocxx*

say?

Comment by kapil gupta [ 11/Aug/16 ]

-I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/bsoncxx/v_noabi -L/usr/local/lib -lmongocxx -lbsoncxx

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

And, what does:

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --cflags --libs libmongocxx libbsoncxx

Report?

Comment by kapil gupta [ 11/Aug/16 ]

This is the output:
0x0000000000000001 (NEEDED) Shared library: [libmongocxx.so._noabi]
0x0000000000000001 (NEEDED) Shared library: [libbsoncxx.so._noabi]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

What does

readelf -a ./hellomongo | egrep 'NEEDED|RPATH'

Report?

Comment by kapil gupta [ 11/Aug/16 ]

That is my default library path. I tried to explicitly tell it the path too, gives the same error.

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

Is /usr/local in the default library search on your system? If not, you probably need to tell the linker to embed /usr/local for the path into hellomongo. Something like:

g++ -o ./helloworld -Wl,-rpath,/usr/local/lib ...

As a test, you could try running your hellomongo binary with LD_LIBRARY_PATH=/usr/local/lib set in the environment and see if that fixes it.

Comment by kapil gupta [ 11/Aug/16 ]

-DCMAKE_INSTALL_PREFIX=/usr/local

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

What was your install prefix when you installed the driver?

Comment by kapil gupta [ 11/Aug/16 ]

I have another problem regarding the driver. I installed the c++ driver successfully and compiled the code provided for testing . On the running the code, I get this error :

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

Is this an error caused due to incorrect installation or just a linking error?

Comment by kapil gupta [ 11/Aug/16 ]

I just needed a sudo to get clearance to create a folder. Guess should have read the log first :/

Comment by Andrew Morrow (Inactive) [ 11/Aug/16 ]

Can you attach the files that

ls /home/cortana/Desktop/mongo-cxx-driver-master/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log

lists? That should make it possible to see what error is preventing MNMLSTC from installing.

Generated at Wed Feb 07 22:01:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.