[CDRIVER-1226] Update C++ instructions for C Driver, and consistently name a VS version in install guide Created: 07/May/16  Updated: 11/Sep/19  Resolved: 16/Jun/16

Status: Closed
Project: C Driver
Component/s: Build
Affects Version/s: 1.3.5
Fix Version/s: 1.4.0

Type: Task Priority: Major - P3
Reporter: George Thompson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 10
MS VS 2013
mongodb R3.3.5
cmake version 3.5.2 (Kitware)


Issue Links:
Duplicate
Related
related to CXX-913 Cannot compile the C++ driver Closed

 Description   

It has been several years since I worked on mongoDB (Windows 7 64 bit SP1 & mongoDB 2.2.0) and was able to install the c++ driver as part of building mongodb from source. Apparently that has changed.

I have built R3.3.5 from source. According to https://github.com/mongodb/mongo-cxx-driver/wiki/Quickstart-Guide-%28New-Driver%29 I need to first build the C driver and then the C++ driver.

Following this documentation to install on Windows:

https://github.com/mongodb/mongo-c-driver/blob/master/README.rst

Downloaded zip and stored it in C:\mongo-c-driver-1.3.5

Per the README:

cd mongo-c-driver-1.3.5
cd src\libbson
cmake -DCMAKE_INSTALL_PREFIX=C:\usr -G "Visual Studio 12 Win64" .

Returned this error:

CMake Error: The source directory "C:/mongo-c-driver-1.3.5/src/libbson" does not appear to contain CMakeLists.txt.

Which makes sense because src/libson is empty. CMakeLists.txt is in C:/mongo-c-driver-1.3.5

So I try running cmake in the mongo-c-driver-1.3.5 directory:

C:\mongo-c-driver-1.3.5>cmake -DCMAKE_INSTALL_PREFIX=C:\usr -G "Visual Studio 12 Win64" .
– The C compiler identification is MSVC 18.0.40629.0
– The CXX compiler identification is MSVC 18.0.40629.0
– Check for working C compiler using: Visual Studio 12 2013 Win64
– Check for working C compiler using: Visual Studio 12 2013 Win64 – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler using: Visual Studio 12 2013 Win64
– Check for working CXX compiler using: Visual Studio 12 2013 Win64 – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found BSON: BSON-NOTFOUND;ws2_32
– Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
– Searching for sasl/sasl.h
– Not found (specify -DCMAKE_INCLUDE_PATH=C:/path/to/sasl/include for SASL support)
– Searching for libsasl2
– Not found (specify -DCMAKE_LIBRARY_PATH=C:/path/to/sasl/lib for SASL support)
Current version (from VERSION_CURRENT file): 1.3.5
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
BSON (ADVANCED)
linked by target "mongoc_shared" in directory C:/mongo-c-driver-1.3.5
linked by target "mongoc_static" in directory C:/mongo-c-driver-1.3.5

– Configuring incomplete, errors occurred!
See also "C:/mongo-c-driver-1.3.5/CMakeFiles/CMakeOutput.log".

So any clues on how to install the C driver so I can get on to installing the C++ driver?

Thanks. Tried posting to mongodb-user with no results.



 Comments   
Comment by Githook User [ 16/Jun/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1226 fix cmake arg in install guide
Branch: master
https://github.com/mongodb/libbson/commit/0d22cadc6e97192fb3a7bd46163095e3ebd1ec58

Comment by Githook User [ 17/May/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1226 fix cmake arg in install guide
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/7bd6891aa14a6f0e8811b0caf2de3ca0cbf843ef

Comment by A. Jesse Jiryu Davis [ 08/May/16 ]

Good point, thanks for the correction.

Comment by George Thompson [ 08/May/16 ]

Thank you so much for the help (and the patience). Sorry that I didn't get the difference between the tarball and the zip of the source. Everything appeared to go without error!

FWIW, I believe there is an error in the instructions.

https://api.mongodb.com/c/current/installing.html#building-windows

It states in the section "Now let's do the same for the MongoDB C driver."

cmake -G "Visual Studio 2012 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" "-DBSON_ROOT_DIR=C:\mongo-c-driver"

I believe it is meant to state:

cmake -G "Visual Studio 10 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" "-DBSON_ROOT_DIR=C:\mongo-c-driver"

I.e., "10" and not "2012" to be consistent with the previous cmake -G generator. I used "12" in both cases as I am using VS 2013.

And now on to install the C++ driver!

Comment by A. Jesse Jiryu Davis [ 07/May/16 ]

Hi, sorry for the trouble. Please download a release tarball instead of a mere zip of the source:

https://github.com/mongodb/mongo-c-driver/releases

The release tarball has everything you need, including the contents of src/libbson. If you then follow the directions to build for Windows:

https://api.mongodb.com/c/current/installing.html#building-windows

That should work fine for you. Please reopen this ticket if you have further trouble.

As followup, I'll make sure the C++ driver README is improved.

Generated at Wed Feb 07 21:11:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.