[CXX-565] mongo::client::initialize() crashes Created: 19/Mar/15 Updated: 23/Mar/15 Resolved: 23/Mar/15 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | API |
| Affects Version/s: | legacy-1.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Judy Han [X] | Assignee: | Adam Midvidy |
| Resolution: | Done | Votes: | 0 |
| Labels: | legacy-cxx | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
mongo::client::initialize() crashes when compiler __cplusplus is 201103. |
| Comments |
| Comment by Judy Han [X] [ 23/Mar/15 ] | ||||||||
|
Hi Adam, | ||||||||
| Comment by Adam Midvidy [ 23/Mar/15 ] | ||||||||
|
Hi Judy, Glad to hear that worked. Also, if you are already using C+11 you should take a look at our new C+11 driver, which can be found here: https://github.com/mongodb/mongo-cxx-driver/tree/master It is not completely stable yet, but it offers a much more idiomatic API. You can read more about it here: http://www.mongodb.com/blog/post/introducing-new-c-driver Adam | ||||||||
| Comment by Judy Han [X] [ 23/Mar/15 ] | ||||||||
|
Hi Adam | ||||||||
| Comment by Adam Midvidy [ 23/Mar/15 ] | ||||||||
|
Can you try passing the -cc and -cxx options to manually specify the location of gcc 4.8 and g++ 4.8 to SCons? | ||||||||
| Comment by Judy Han [X] [ 23/Mar/15 ] | ||||||||
|
Hi Adam, I did some experiments, following code compiles and runs successfully with or without -std=c++11 flag
It's almost like something is missing in SConstruct to get the right environment. The reason I say that is it looks like that's how SConstruct decide if we are using libstdc++4.6.0 or older version. Thanks, | ||||||||
| Comment by Adam Midvidy [ 23/Mar/15 ] | ||||||||
|
Hi Judy, Unfortunately this does not seem to be a driver issue, but rather a toolchain misconfiguration. We are only able to assist with issues involving the driver itself. I would suggest contacting Red Hat and asking for assistance on properly enabling devtoolset-2. Adam | ||||||||
| Comment by Judy Han [X] [ 23/Mar/15 ] | ||||||||
|
Hi Adam, I did have following for all my tests we discussed:
Thanks! | ||||||||
| Comment by Adam Midvidy [ 23/Mar/15 ] | ||||||||
|
Hi Judy, MongoDB C++ driver supports -std=c++11 on RHEL 6.6. It looks like you have the devtoolset-2 installed, but you need to enable it. Try
Then recompile the driver with -std=c++11. Adam | ||||||||
| Comment by Judy Han [X] [ 23/Mar/15 ] | ||||||||
|
Hi Adam, Just want to clarify that for Redhat 6.6, mongodb c++ driver does not support -std=c++11? What driver do you recommand if performance is our major concern? Thanks! | ||||||||
| Comment by Judy Han [X] [ 20/Mar/15 ] | ||||||||
|
Hi Adam, I see. Thanks for the information. Do you have any suggestions? | ||||||||
| Comment by Adam Midvidy [ 20/Mar/15 ] | ||||||||
|
Judy, libstdc++4.6.0 is a requirement for compiling the driver with C++11 enabled. If you require compiling the driver in C++11 mode, you should upgrade to a newer libstdc++. Adam | ||||||||
| Comment by Judy Han [X] [ 20/Mar/15 ] | ||||||||
|
ah, thanks! scons --cpppath=/home/jhan/Software/boost/boost_1_55_0 --extrapath=/home/jhan/workspace/MTX/publish_linux/opt/mtx --c++11=on --config=force --sharedclient install-examples I see, I have: Is the requirement for libstdc++4.6.0 or better a mongo client driver requirement? Thanks! | ||||||||
| Comment by Adam Midvidy [ 19/Mar/15 ] | ||||||||
|
Ah, you should compile without the -Q flag which suppresses the relevant scons output. The configure output will look like this (without -Q flag)
| ||||||||
| Comment by Judy Han [X] [ 19/Mar/15 ] | ||||||||
|
Hi Adam, Here is the full output for the rerun: Not sure if that is what your are refering to when you mentioned "full configure output of Scons", if not please let me know. Since I have multiple compilers installed in my machine and to get the c++11, I do following before I compile my programs: %which g++ %/sbin/ldconfig -p |grep stdc++ %strings /usr/lib/libstdc++.so.6|grep LIBCXX Thanks! | ||||||||
| Comment by Adam Midvidy [ 19/Mar/15 ] | ||||||||
|
Judy, That is an odd error as GCC 4.8.2 is a fairly modern compiler - I build with the same version. Can you rerun scons with the same options (including c++11=on), but add --config=force. Then can you reply with the full configure output of SCons (everything before "scons: building targets...") Additionally can you let me know the version of libstdc++ installed on your machine? Thanks, | ||||||||
| Comment by Judy Han [X] [ 19/Mar/15 ] | ||||||||
|
Hi Adam, when I tried --c++11=on option for compiling the driver, I got following error: scons version: 2.0.1 This is my g++ version Thanks! | ||||||||
| Comment by Adam Midvidy [ 19/Mar/15 ] | ||||||||
|
Hi Judy, I think the problem is that you are compiling the driver with c++03, but compiling your application with c++11. As the ABI of libstdc++ changed with the introduction of c++11, it is not possible to link a c++98/03 static library into a c++11 application. Can you try recompiling the driver with the --c++11=on option, and removing your modification to functional.h? Thanks, | ||||||||
| Comment by Judy Han [X] [ 19/Mar/15 ] | ||||||||
|
Hi Adam, The compiling command for my application is: The key flag is -std=c++11, without this flag, it works, but with this flag, it core dumps because it uses std::function instead of boost::function. Thanks! | ||||||||
| Comment by Adam Midvidy [ 19/Mar/15 ] | ||||||||
|
Hi Judy - I am sorry to hear you are having trouble compiling the legacy driver. Can you tell me the exact SCons invocation you used to compile the legacy driver, as well as the compiler flags used to compile your application? Thanks, |