I need to compile the MongoDB driver for windows x64 (.dll extension). I was following this tutorial with visual studio 16 2019 and cmake 3.17.0, but I found several problems:
- First step is:
$ cd mongo-c-driver-x.y.z
$ mkdir cmake-build
$ cd cmake-build
$ cmake -G "Visual Studio 14 2015 Win64" \
"-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" \
"-DCMAKE_PREFIX_PATH=C:\mongo-c-driver" \
..
But I received errors about missing information at top of the CMakeLists.txt file. cmake_minimum_required & project(). So I wrote them.
- Then, at the end of the file it was written the following:
set_dist_list (src_libmongoc_tests_DIST
CMakeLists.txt
${src_libmongoc_tests_DIST_cs}
${src_libmongoc_tests_DIST_hs}
${src_libmongoc_tests_DIST_zeros}
${src_libmongoc_tests_DIST_pems}
${src_libmongoc_tests_DIST_dats}
${src_libmongoc_tests_DIST_txts}
${src_libmongoc_tests_DIST_jsons}
)
I had to erase it because of error with the set_dist_list command
- Once erased it worked well with the command:
cmake -G "Visual Studio 16 2019" -A "x64" -S "C:\...\mongo-c-driver-1.16.2" -B "C:\...\mongo-c-driver-1.16.2\cmake-build3" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" "-DCMAKE_PREFIX_PATH=C:\mongo-c-driver"
- Next step was:
$ msbuild.exe /p:Configuration=RelWithDebInfo ALL_BUILD.vcxproj
It worked well.
- Next step was:
$ msbuild.exe INSTALL.vcxproj
There wasn't INSTALL.vcxproj file, so I couldn't execute the command. I tried several times but didn't find solution to the problem. But I found this on stackoverflow. I followed all the steps but when I searched for mongo-c-driver there was only the 1.15.1 available. I continued anyways but when the process finished I found that the drivers where x86 and not x64 (they're in a folder called x86-windows) and the drivers seem to be 1.0 version (they are called libmongoc-1.0.dll & libbson-1.0.dll).
So, the conclusion is that I wasted a lot of time I couldn't build the drivers. What I did wrong on both processes? How I can get the last version of the mongo-c-driver compiled for x64 on .dll format?
Many thanks for your time and responses, I don't know how to continue,
Héctor