Bug in new C++ driver?

499 views
Skip to first unread message

Xauxatz

unread,
May 9, 2016, 7:26:46 AM5/9/16
to mongodb-user

When I try to compile my C++ program, I get an error when linking with the MongoDB new C++ driver (mongocxx) that there is an undefined reference.


The problem is easy to reproduce. Just try to compile the test example with in the quickstart guide (https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver)). This is the error code:


hellomongo.cpp:(.text+0x3f): undefined reference to `mongocxx::v_noabi::uri::k_default_uri[abi:cxx11]'


I am using the newest 3.0.1 version of the C++ driver. The error was also there with 3.0.0.


Host: Ubuntu 64 bit

gcc: 5.1.1


Thanks for any help!


Andrew Morrow

unread,
May 9, 2016, 11:26:11 AM5/9/16
to mongod...@googlegroups.com

Hi - 

Could you please provide some additional information that will help us diagnose the issue? In particular, could you provide:

- The CMake invocation you used to generate the C++11 driver build system, and its output.
- The make/ninja or other commend you executed to build and install the C++11 driver
- The command line that you used to build the application and link it to the installed C++11 driver.

That abi:cxx11 tag makes me think that you have mixed libstdc++ ABI versions somewhere.

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/492a1364-1c12-4b36-ab80-9eebda3bcc19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xauxatz

unread,
May 10, 2016, 4:08:47 AM5/10/16
to mongodb-user
I use cmake version 3.2.2.  I am not sure how to find the "CMake invocation", sorry...
I followed the instructions on this page precisely though: https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver)

I just tried to repeat the process from the beginning, first compiling the C driver, then the C++ driver.
But now I am stuck with this when doing a "make" in "mongo-cxx-driver/build":

[  3%] Performing install step for 'EP_mnmlstc_core'
CMake Error at /home/osboxes/VisualGDB/d/Code/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install.cmake:16 (message):
 
Command failed: 2


   
'make' 'install'


 
See also


   
/home/osboxes/VisualGDB/d/Code/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log


I see that this problem has been reported before but the suggested answer was to update the toolchain (here). I believe I have the newest versions of all tools required, including cmake.
So how can I fix the above problem and finally get it all to work. I've spent days on trying to get this running by now.

Xauxatz

unread,
May 10, 2016, 8:15:23 AM5/10/16
to mongodb-user
I now tried with a completely clean Ubuntu virtual machine and followed precisely the instructions for installing the new C++ driver (here)

No matter what I do I run into the problem with EP_mnmlstc_core. The build process is broken.

gcc: 5.3.1
cmake: 3.5.1
ubuntu: 16.04 (64 bit)

Andrew Morrow

unread,
May 10, 2016, 8:19:48 AM5/10/16
to mongod...@googlegroups.com

In your clean VM, please show me:

- How you ran CMake. Somewhere, you typed 'cmake' followed by some arguments. What were the arguments, and what was the result printed to the console? Or did you use the CMake gui?

- After you ran cmake, you typed make, or ninja, or something else, to build the driver with the build system that CMake generated. What did you type, and what was the result?

- In the case above where the build provided a reference to log files, what was in those files (/home/osboxes/VisualGDB/d/Code/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log).

- What error are you getting in your clean VM?

- Do you have git installed and available in your path?

Thanks,
Andrew


Xauxatz

unread,
May 10, 2016, 8:58:22 AM5/10/16
to mongodb-user
Hi Andrew

I checked the log file of EP_mnmlstc_core as you suggested and the contents indicated that cmake could not create a directory /usr/local/include/bsoncxx...

I am now running make (of mongo-cxx-driver) with sudo - and it works.

So perhaps you should update the build guide - and I should learn to check the log files :-)

Many thanks!

Andrew Morrow

unread,
May 10, 2016, 9:08:08 AM5/10/16
to mongod...@googlegroups.com

Did you explicitly select /usr/local as your installation prefix with when invoking CMake by setting -DCMAKE_INSTALL_PREFIX=/usr/local (or the equivalent in the GUI)?

Otherwise, the driver should default to building to a directory called 'install' under the current build directory:


But, yes, if you explicitly selected an install prefix that the current user cannot write to, you will need to use sudo, and you need to do it at build time, not just install time, since the ExternalProject_Add step which is invoked at build time needs to itself run an install of MNMLSTC/core.

Thanks,
Andrew



Claus Skaaning

unread,
May 10, 2016, 10:12:49 AM5/10/16
to mongod...@googlegroups.com
Hi - yes I explicitly set it, since I didn't see that the environment variable for the CDRIVER was set.
So that's probably the reason.
Thanks again.
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/BQvTonyD9pE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.

To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.

Edward Lee

unread,
Oct 16, 2016, 9:36:47 AM10/16/16
to mongodb-user
when I compile the tutorial code, I still have the compile error 'undefined reference'.
Is that all Ok after you compile the mongocxx by yourself?

在 2016年5月10日星期二 UTC+8下午10:12:49,Xauxatz写道:

Andrew Morrow

unread,
Oct 17, 2016, 10:26:54 AM10/17/16
to mongod...@googlegroups.com

Please don't reply to old threads. Could you please start a new thread describing the issue you are having in greater detail? In particular, include the version of the driver you are using, the toolchain, how you built the driver, the code you are trying to build against the driver, and the exact error message you are seeing.

Thanks,
Andrew


For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/

---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.

To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages