Reputation: 256
I am trying to follow this guide, and I am currently at step 3.
So after running,
curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.1.tar.gz
tar -xzf r3.0.1.tar.gz
cd mongo-cxx-driver-r3.0.1/
I try to do similar commands as in the Windows guide for mongoc:
If I do just
cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/mongo-cxx-driver"
I get an error
CMake Error at cmake/FindLibBSON.cmake:37 (message):
Don't know how to find libbson; please set LIBBSON_DIR to the prefix
directory with which libbson was configured.
Call Stack (most recent call first):
src/bsoncxx/CMakeLists.txt:67 (find_package)
So here I have tried different things, like adding the paths to the libsson directory:
cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/mongo-cxx-driver" "-DLIBBSON_DIR=C:/mongo-c-driver/lib/pkgconfig/" "-DLIBMONGOC_DIR=C:/mongo-c-driver/lib/pkgconfig/" "-DBOOST_ROOT=C:/local/boost_1_62_0/"
This actually works, but then when I try to build with
msbuild.exe ALL_BUILD.vcxproj
I get an error:
C:\Users\Erik\Documents\mongo-cxx-driver-r3.0.1\src\bsoncxx\array\view.cpp(21): fatal error C1083: Cannot open include
file: 'bson.h': No such file or directory [C:\Users\Erik\Documents\mongocxx-driver-r3.0.1\src\bsoncxx\bsoncxx_static.v
cxproj]
This file, "bson.h" seems to reside in the direcroty
C:\mongo-c-driver\include\libbson-1.0
but I am not sure why it does not find the file or how I could make it do so.
Greatly appreciate any input on this.
Upvotes: 2
Views: 2515
Reputation: 21486
October, 18 2016
This issue happens to Mac OS X as well, and maybe to other Un*xes.
curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.2.tar.gz
build
directory, but to the root:cd mongo-cxx-driver-r3.0.2
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/mongodbDriverCpp -DLIBBSON_DIR=/opt/mongodbDriverCpp -DLIBMONGOC_DIR=/opt/mongodbDriverCpp -DCMAKE_CXX_STANDARD=14
make make install
/opt/mongodbDriverCpp
to your right directory):c++ --std=c++11 test.cpp -o run.test -I/opt/mongodbDriverCpp/include/bsoncxx/v_noabi -I /opt/mongodbDriverCpp/include/mongocxx/v_noabi/ -L /opt/mongodbDriverCpp/lib -l mongocxx -l bsoncxx
export LD_LIBRARY_PATH=/opt/mongodbDriverCpp/lib ./run.test
Upvotes: 0
Reputation: 12727
You are not setting LIBBSON_DIR
and LIBMONGOC_DIR
correctly. They should, in your case, be both set to C:\mongo-c-driver
. The build system will automatically add include
and lib
to that base path as needed. You might find reading the appveyor script informative:
CMAKE_INSTALL_PREFIX
for libmongoc here: https://github.com/mongodb/mongo-cxx-driver/blob/master/appveyor.yml#L25LIBBSON_DIR
and LIBMONGOC_DIR
here when invoking CMake for mongocxx: https://github.com/mongodb/mongo-cxx-driver/blob/master/appveyor.yml#L31Upvotes: 4