C++ Driver - CMake Error: The source directory "" does not appear to contain CMakeLists.txt.

1,712 views
Skip to first unread message

Waley Chen

unread,
Apr 25, 2015, 7:01:09 AM4/25/15
to mongo...@googlegroups.com
I'm following the MongoDB C++ Driver Quickstart Guide - https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-(New-Driver)

I cd into the "mongo-cxx-driver/build" directory, then run
"cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .."

and get this message back:
"CMake Error: The source directory "/Users/Waley/code/mongo-cxx-driver" does not appear to contain CMakeLists.txt."

How do I fix this error?

Thanks,
Waley

Andrew Morrow

unread,
Apr 25, 2015, 9:36:52 AM4/25/15
to mongo...@googlegroups.com

Hi -

If you run 

ls /Users/Waley/code/mongo-cxx-driver

What is the output? 

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/d/optout.

Waley Chen

unread,
May 1, 2015, 6:10:34 AM5/1/15
to mongo...@googlegroups.com

Output is the following:

APACHE-2.0.txt

CONTRIBUTING.md

README.md

SConstruct

build docs

etc

site_scons

src

Waley Chen

unread,
May 1, 2015, 6:42:24 AM5/1/15
to mongo...@googlegroups.com

"CMakeLists.txt" is missing but I'm not sure why it's missing or how to get it.

Andrew Morrow

unread,
May 1, 2015, 8:26:15 AM5/1/15
to mongo...@googlegroups.com

Hi -

It looks to me like you have the legacy branch checked out. If you want to build the experimental C++11 driver, you should check out the master branch with 'git checkout master'. The 'legacy' branch is currently the default when cloning since it has the newest stable release.

Thanks,
Andrew

Waley Chen

unread,
May 1, 2015, 9:44:53 AM5/1/15
to mongo...@googlegroups.com
Thanks!

I was able to make it to the next step and ran 
"sudo make && sudo make install"

The build ran to 92% until it hit an error

[ 92%] Building CXX object src/mongocxx/test/CMakeFiles/test_driver.dir/collection.cpp.o

In file included from /Users/Waley/code/mongo-cxx-driver/src/mongocxx/test/collection.cpp:1:

In file included from /Users/Waley/code/mongo-cxx-driver/src/third_party/catch/include/catch.hpp:408:

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:1089:9: error: no matching member function for call to 'push_back'

        push_back(*__first);

        ^~~~~~~~~

/Users/Waley/code/mongo-cxx-driver/src/mongocxx/test/collection.cpp:426:47: note: in instantiation of function template specialization 'std::__1::vector<bsoncxx::v0::document::value,

      std::__1::allocator<bsoncxx::v0::document::value> >::vector<mongocxx::v0::cursor::iterator>' requested here

        std::vector<bsoncxx::document::value> results(distinct_results.begin(),

                                              ^

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:700:36: note: candidate function not viable: no known conversion from 'const bsoncxx::document::view' to 'const value_type'

      (aka 'const bsoncxx::v0::document::value') for 1st argument

    _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);

                                   ^

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:702:36: note: candidate function not viable: no known conversion from 'const bsoncxx::document::view' to 'value_type'

      (aka 'bsoncxx::v0::document::value') for 1st argument

    _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);

                                   ^

1 error generated.

make[2]: *** [src/mongocxx/test/CMakeFiles/test_driver.dir/collection.cpp.o] Error 1

make[1]: *** [src/mongocxx/test/CMakeFiles/test_driver.dir/all] Error 2

make: *** [all] Error 2

Andrew Morrow

unread,
May 1, 2015, 10:23:32 AM5/1/15
to mongo...@googlegroups.com

Hi -

I'll need a few other pieces of information:

- What is the exact CMake invocation you are using?
- What is the local OS and version (looks like OS X)
- What is the toolchain, and version (e.g. output of --version)

Thanks,
Andrew

adam.m...@10gen.com

unread,
May 1, 2015, 11:22:47 AM5/1/15
to mongo...@googlegroups.com
Hi Waley,

I've managed to reproduce your compile failure using Apple LLVM 5.1 (clang 3.4). Is that the toolchain you are using? If you are not sure please paste the output of 

$ clang++ --version

I've filed an ticket in our issue tracker to fix this.

As a temporary workaround, can you can comment out the last line of src/mongocxx/CMakeLists.txt. You just need to put a '#' character in front of the line 'add_subdirectory(testing)'. Then you can rerun cmake and re-execute the make invocation.

Let me know if this works.

Thanks,
Adam

Waley Chen

unread,
May 1, 2015, 11:14:42 PM5/1/15
to mongo...@googlegroups.com
Holy crap that was a fast fix.
Pulled latest, everything works now.

Thanks!!!
Reply all
Reply to author
Forward
0 new messages