I am going through the installation steps exactly as they on the website so the commands I’m using are the same. When I am trying to configure the driver in step 4 using cmake, I am getting this error.
bsoncxx version: 3.6.2
CMake Error at src/bsoncxx/CMakeLists.txt:98 (find_package):
By not providing "Findlibbson-1.0.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"libbson-1.0", but CMake did not find one.
Could not find a package configuration file provided by "libbson-1.0"
(requested version 1.13.0) with any of the following names:
libbson-1.0Config.cmake
libbson-1.0-config.cmake
Add the installation prefix of "libbson-1.0" to CMAKE_PREFIX_PATH or set
"libbson-1.0_DIR" to a directory containing one of the above files. If
"libbson-1.0" provides a separate development package or SDK, be sure it
has been installed.
-- Configuring incomplete, errors occurred!
See also "/root/mongo-cxx-driver-r3.6.2/build/CMakeFiles/CMakeOutput.log".
I have tried reinstalling just about everything but I haven’t gotten anywhere. I’m new to linux too so any gerneral guidance is appreciated!!
@Luke_Colias can you please provide the sequence of commands you used to configure, build, and install the C driver, along with the full output of each. Also, please provide the complete CMake command and output for the attempted C++ driver build.
I’m running these commands on centOS 8. Also I’m building these under the root directory, I know that’s probably not how I’m supposed to do it, but my advisor told me it would make things easier.
These are the commands I run for the c driver.
curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.2/mongo-cxx-driver-r3.6.2.tar.gz
tar -xzf mongo-cxx-driver-r3.6.2.tar.gz
cd mongo-cxx-driver-r3.6.2/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local
At this last cmake command is where I’m getting the error from above. I understand that I’m getting the error because something isn’t installed in the right location I just don’t know where I went wrong because I’m still relatively new Linux in general.
@Luke_Colias it does not make sense that you install the mongo-c-driver and libbson packages via yum and then try to build from source as well. If the packages available via yum are of a sufficiently recent version for you, then simply install the -devel packages of each and be done with it. If you need to build from source, then it is best to not also have the packages installed via yum at the same time. Apart from that, the commands you executed are helpful, but if you note my previous comment we need the full output to be able to effectively diagnose the issue. That said, based on the command sequence for the C driver, it looks like you built it but did not actually install it. You might need something like cmake --build . --target install (possibly with sudo if your installation prefix is in a system directory).
Okay I Think I understand more now, how would I install the -devel packages of the c driver and libbson? I get now that I installed them via yum so but I dont fully get the distinction between that and what the -devel package is.
That’s right. Just make sure that you select a C++ driver version that supports the C driver version you installed. (I don’t recall what version is available by default from CentOS 8).
Okay It says the package that was installed is “(4/5): mongo-c-driver-devel-1.17.2-1.el8.x86_64” so I assume that means i can use the latest version of the c++ driver.
And everything looks good becasue its giving me this message at the end
Build files have been written to: /root/mongo-cxx-driver-r3.6.2/build
Now when I run the build command do I have to add the mnmlstc core flagg becasue im really not sure about what that is.
(P.S. Also I appreciate all of this so much I was stuck on this forever and you just knocked out like 10 hours of frustration in like 20 min, thank you!)
Also I’m not really sure what the poly fill is. I know in the other post you said I have two option and those would be to use the compiler that C++17 support for my polyfill(which seems easiert). And the other option would be to download MNMLSTC code from guithub which sounds like more effort and i dont know if i even need it. I was thinking I could just run the command:
If you don’t want to use the MNMLSTC that the build tries to download and build for you, you will need to specify the option that you prefer. Have a look at Step 2 in the installation guide.
The build defaults to downloading MNMLSTC_core from GitHub and using that for the polyfill. However, you do not install it as a specific target. That is handled by the normal building and installation of the overall driver.
Yes, you should be able to continue as normal. The build instructions do not say to run the EP_mnmlstc_core target because not every build will have it. The build figures out if that target is needed based on the CMake options provided and then handles any build and install steps required for that.