Mongo-cxx MinGW installation

Hi, I have been following this guide with the hopes of using mongoDB with QT 5.12.7 MinGW 64 bit in QT creator
http://mongocxx.org/mongocxx-v3/installation/

For step 1, I used c:\msys64\mingw64.exe to get mongo-c-driver 1.16.2 to install with no issues following this link: Installing the MongoDB C Driver (libmongoc) and BSON library (libbson) - libmongoc 1.26.1

For step 2, I made the assumption that i will need -DBSONCXX_POLY_USE_BOOST=1, and i downloaded boost_1_73_0 from online and made C:\local\boost_1_73_0

For step 3, I followed pasted the lines from the text box into the MinGW shell in c:\msys64\mingw64.exe


curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.5.0.tar.gz
tar -xzf r3.5.0.tar.gz
cd mongo-cxx-driver-r3.5.0/build

For step 4, i pasted this in the mingw shell


‘C:\Program Files\CMake\bin\cmake.exe’ …
-G “Visual Studio 15 2017 Win64”
-DBOOST_ROOT=C:\local\boost_1_73_0
-DCMAKE_PREFIX_PATH=C:\mongo-c-driver
-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver
-DBUILD_VERSION=3.5.0

my problem is nearly identical to this post, but i didnt want to hijack the thread

as for the questions related to this topic
-location is specified with mingw shell using this command cd mongo-cxx-driver-r3.5.0/build
-i dont plan to use Visual studio, just QT creator with minGW
-complete error output


*$ ‘C:\Program Files\CMake\bin\cmake.exe’ … *
*> -G “Visual Studio 15 2017 Win64” *
*> -DBOOST_ROOT=C:\local\boost_1_73_0 *
*> -DCMAKE_PREFIX_PATH=C:\mongo-c-driver *
*> -DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver *
> -DBUILD_VERSION=3.5.0
– The CXX compiler identification is MSVC 19.16.27025.1
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– No build type selected, default is Release
– The C compiler identification is MSVC 19.16.27025.1
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Auto-configuring bsoncxx to use boost std library polyfills since C++17 is inactive and compiler is MSVC
bsoncxx version: 3.5.0
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 “C:/msys64/home/agovan/mongo-cxx-driver-r3.5.0/build/CMakeFiles/CMakeOutput.log”.

@Akash_Govan, first if you build from the release tarball (which your post indicates that you are not) then you will not need to specify -DBUILD_VERSION=... in your CMake command. The correct link for the release tarball is https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.5.0/mongo-cxx-driver-r3.5.0.tar.gz while you downloaded the source tree snapshot where it was tagged. The team is aware of the discrepancy and we are discussing how to update the documentation to eliminate this and other items which are unclear.

That said, let’s consider this part of your output:

This indicates that either you did not actually install the C driver at the specified location (C:\mongo-c-driver, based on the CMake command you are using for the C++ driver build) either by not executing the install target or by choosing a different directory, or you supplied some option to the C driver build to disable the build of the DLL (which would produce only static libraries). If you would post the entirety of the output for your C driver build, I could help you determine the precise cause.

I tried removing the files and doing a reinstall of the C driver build.

using c:\msys64\ming64.exe
i installed the dependencies with
pacman --noconfirm -Syu
pacman --noconfirm -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
pacman --noconfirm -S mingw-w64-x86_64-extra-cmake-modules make tar
pacman --noconfirm -S mingw64/mingw-w64-x86_64-cyrus-sasl

then i ran these commands after untaring the build
mkdir cmake-build
cd cmake-build
CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -G “MSYS Makefiles” -DCMAKE_INSTALL_PREFIX=“C:/mongo-c-driver” -DCMAKE_C_FLAGS=“-D__USE_MINGW_ANSI_STDIO=1” …
make install

there is a character limit, so pasting 20 pages of install output wont fit, but i’ll try to paste the main points
agovan@LENOVO-AKASH MINGW64 ~
$ curl -LO https://github.com/mongodb/mongo-c-driver/releases/download/1.16.2/mongo-c-driver-1.16.2.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 637 100 637 0 0 1151 0 --:–:-- --:–:-- --:–:-- 1149
100 6726k 100 6726k 0 0 2164k 0 0:00:03 0:00:03 --:–:-- 3334k

agovan@LENOVO-AKASH MINGW64 ~
$ tar xzf mongo-c-driver-1.16.2.tar.gz

agovan@LENOVO-AKASH MINGW64 ~
$ cd mongo-c-driver-1.16.2

agovan@LENOVO-AKASH MINGW64 ~/mongo-c-driver-1.16.2
$ mkdir cmake-build

agovan@LENOVO-AKASH MINGW64 ~/mongo-c-driver-1.16.2
$ cd cmake-build

agovan@LENOVO-AKASH MINGW64 ~/mongo-c-driver-1.16.2/cmake-build
$ CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -G “MSYS Makefiles” -DCMAKE_INSTALL_PREFIX=“C:/mongo-c-driver” -DCMAKE_C_FLAGS=“-D__USE_MINGW_ANSI_STDIO=1” …
– The C compiler identification is ;GNU 10.1.0
– Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
– Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– No CMAKE_BUILD_TYPE selected, defaulting to RelWithDebInfo
file VERSION_CURRENT contained BUILD_VERSION 1.16.2
– Using bundled libbson
libbson version (from VERSION_CURRENT file): 1.16.2
– Check if the system is big endian
– Searching 16 bit integer
– Looking for sys/types.h
– Looking for sys/types.h - found
– Looking for stdint.h
– Looking for stdint.h - found
– Looking for stddef.h
– Looking for stddef.h - found
– Check size of unsigned short
– Check size of unsigned short - done
– Searching 16 bit integer - Using unsigned short
– Check if the system is big endian - little endian
– Looking for snprintf
– Looking for snprintf - found
– Looking for reallocf
– Looking for reallocf - not found
– Performing Test BSON_HAVE_TIMESPEC
– Performing Test BSON_HAVE_TIMESPEC - Success
– struct timespec found
– Looking for gmtime_r
– Looking for gmtime_r - not found
– Looking for rand_r
– Looking for rand_r - not found
– Looking for strings.h
– Looking for strings.h - found
– Looking for strlcpy
– Looking for strlcpy - not found
– Looking for clock_gettime
– Looking for clock_gettime - found
– Looking for strnlen
– Looking for strnlen - found
– Looking for stdbool.h
– Looking for stdbool.h - found
– Looking for SYS_gettid
– Looking for SYS_gettid - not found
– Looking for syscall
– Looking for syscall - not found
– Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH
– Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH - Success
– Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH
– Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH - Success
– Looking for pthread.h
– Looking for pthread.h - found
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
– Found Threads: TRUE
libmongoc version (from VERSION_CURRENT file): 1.16.2
– Searching for zlib CMake packages
– Found ZLIB: C:/msys64/mingw64/lib/libz.dll.a (found version “1.2.11”)
– zlib found version “1.2.11”
– zlib include path “C:/msys64/mingw64/include”
– zlib libraries “C:/msys64/mingw64/lib/libz.dll.a”
– Looking for include file unistd.h
– Looking for include file unistd.h - found
– Looking for include file stdarg.h
– Looking for include file stdarg.h - found
– Searching for compression library zstd
– Found PkgConfig: C:/msys64/mingw64/bin/pkg-config.exe (found version “0.29.2”)
– Checking for module ‘libzstd’
– Found libzstd, version 1.4.4
– Found zstd version 1.4.4 in C:/msys64/mingw64/include
– Check size of socklen_t
– Check size of socklen_t - done
– Looking for sched_getcpu
– Looking for sched_getcpu - not found
– Searching for compression library header snappy-c.h
– Not found (specify -DCMAKE_INCLUDE_PATH=/path/to/snappy/include for Snappy compression)
– No ICU library found, SASLPrep disabled for SCRAM-SHA-256 authentication.
– If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.
Searching for libmongocrypt
– libmongocrypt not found. Configuring without Client-Side Field Level Encryption support.
– Performing Test MONGOC_HAVE_SS_FAMILY
– Performing Test MONGOC_HAVE_SS_FAMILY - Failed
– Compiling against Secure Channel
– Compiling against Windows SSPI
– Configuring done
– Generating done
– Build files have been written to: C:/msys64/home/agovan/mongo-c-driver-1.16.2/cmake-build

agovan@LENOVO-AKASH MINGW64 ~/mongo-c-driver-1.16.2/cmake-build
$ make install
Scanning dependencies of target bson_shared
[ 1%] Building C object src/libbson/CMakeFiles/bson_shared.dir/src/bson/bcon.c.obj

[16 pages of installing from 1% to 100 % here, which will exceed the post character limit]

[100%] Built target bulk1

Install the project…

– Install configuration: “RelWithDebInfo”

– Installing: C:/mongo-c-driver/share/mongo-c-driver/COPYING

– Installing: C:/mongo-c-driver/share/mongo-c-driver/NEWS

– Installing: C:/mongo-c-driver/share/mongo-c-driver/README.rst

– Installing: C:/mongo-c-driver/share/mongo-c-driver/THIRD_PARTY_NOTICES

– Installing: C:/mongo-c-driver/lib/libbson-1.0.dll.a

– Installing: C:/mongo-c-driver/bin/libbson-1.0.dll

– Installing: C:/mongo-c-driver/lib/libbson-static-1.0.a

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-config.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-version.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bcon.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-atomic.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-clock.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-compat.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-context.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-decimal128.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-endian.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-error.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-iter.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-json.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-keys.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-macros.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-md5.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-memory.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-oid.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-prelude.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-reader.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-string.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-types.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-utf8.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-value.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-version-functions.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson/bson-writer.h

– Installing: C:/mongo-c-driver/include/libbson-1.0/bson.h

– Installing: C:/mongo-c-driver/lib/pkgconfig/libbson-1.0.pc

– Installing: C:/mongo-c-driver/lib/pkgconfig/libbson-static-1.0.pc

– Installing: C:/mongo-c-driver/lib/cmake/bson-1.0/bson-targets.cmake

– Installing: C:/mongo-c-driver/lib/cmake/bson-1.0/bson-targets-relwithdebinfo.cmake

– Installing: C:/mongo-c-driver/lib/cmake/bson-1.0/bson-1.0-config.cmake

– Installing: C:/mongo-c-driver/lib/cmake/bson-1.0/bson-1.0-config-version.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libbson-1.0/libbson-1.0-config.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libbson-1.0/libbson-1.0-config-version.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libbson-static-1.0/libbson-static-1.0-config.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libbson-static-1.0/libbson-static-1.0-config-version.cmake

– Installing: C:/mongo-c-driver/lib/libmongoc-1.0.dll.a

– Installing: C:/mongo-c-driver/bin/libmongoc-1.0.dll

– Installing: C:/mongo-c-driver/lib/libmongoc-static-1.0.a

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-config.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-version.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-apm.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-bulk-operation.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-change-stream.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-client.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-client-pool.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-client-side-encryption.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-collection.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-cursor.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-database.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-error.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-flags.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-find-and-modify.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-gridfs.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-gridfs-bucket.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-gridfs-file.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-gridfs-file-page.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-gridfs-file-list.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-handshake.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-host-list.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-init.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-index.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-iovec.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-log.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-macros.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-matcher.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-opcode.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-prelude.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-read-concern.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-read-prefs.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-server-description.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-client-session.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-socket.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-tls-libressl.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-tls-openssl.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-buffered.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-file.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-gridfs.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-socket.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-topology-description.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-uri.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-version-functions.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-write-concern.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-rand.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-stream-tls.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc/mongoc-ssl.h

– Installing: C:/mongo-c-driver/include/libmongoc-1.0/mongoc.h

– Installing: C:/mongo-c-driver/lib/pkgconfig/libmongoc-1.0.pc

– Installing: C:/mongo-c-driver/lib/pkgconfig/libmongoc-static-1.0.pc

– Installing: C:/mongo-c-driver/lib/pkgconfig/libmongoc-ssl-1.0.pc

– Installing: C:/mongo-c-driver/lib/cmake/mongoc-1.0/mongoc-targets.cmake

– Installing: C:/mongo-c-driver/lib/cmake/mongoc-1.0/mongoc-targets-relwithdebinfo.cmake

– Installing: C:/mongo-c-driver/lib/cmake/mongoc-1.0/mongoc-1.0-config.cmake

– Installing: C:/mongo-c-driver/lib/cmake/mongoc-1.0/mongoc-1.0-config-version.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libmongoc-1.0/libmongoc-1.0-config.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libmongoc-1.0/libmongoc-1.0-config-version.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libmongoc-static-1.0/libmongoc-static-1.0-config.cmake

– Installing: C:/mongo-c-driver/lib/cmake/libmongoc-static-1.0/libmongoc-static-1.0-config-version.cmake

– Installing: C:/mongo-c-driver/share/mongo-c-driver/uninstall.cmd

i fixed my commands after that, but i still get the same error message as my first post
curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.5.0/mongo-cxx-driver-r3.5.0.tar.gz
tar -xzf mongo-cxx-driver-r3.5.0.tar.gz
cd mongo-cxx-driver-r3.5.0/build

‘C:\Program Files\CMake\bin\cmake.exe’ …
-DBOOST_ROOT=C:\local\boost_1_73_0
-DCMAKE_PREFIX_PATH=C:\mongo-c-driver
-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver

one thing i wanted to ask is this cmake command supposed to be building for Visual Studio 15 2017 with -G “Visual Studio 15 2017 Win64”, or should i be using something else if i want it to work in QT creator with mingw?

Im not sure if this may be relevant to my issue, but there is no file called libmongoc in my C:\mongo-c-driver folder, although there appear to be files related to it in the sub folders

I see. The problem is that you are building the C driver for MSYS Makefiles and then building the C++ driver for Visual Studio. Use the same -G "..." option to CMake for both builds. Building the two components with two different toolchains is not supported and, as you have find, may not even work.

What is happening, from a technical perspective, is that the C driver build is creating CMake packages called libbson.... and libmongoc.... (because it is treated as a Unix-like system), but the Visual Studio build is looking for CMake packages called bson.... and mongoc.... (because the convention on Windows is to not use the lib prefix).

I gave it a try, and i got no success, since my goal is to use mongoDB in QT creator with MinGW, and not visual studio, It’s my understanding that -G “MSYS Makefiles” from the “Building on Windows with MinGW-W64 and MSYS2” section of Installing the MongoDB C Driver (libmongoc) and BSON library (libbson) - libmongoc 1.26.1 is the correct option.

when i try this, i end up getting the same error

agovan@LENOVO-AKASH MINGW64 ~/mongo-cxx-driver-r3.5.0/build
$ ‘C:\Program Files\CMake\bin\cmake.exe’ … \

 -G "MSYS Makefiles"           \
-DBOOST_ROOT=C:\local\boost_1_73_0          \
-DCMAKE_PREFIX_PATH=C:\mongo-c-driver       \
-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver

– The CXX compiler identification is GNU 10.1.0
– Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe
– Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– No build type selected, default is Release
– The C compiler identification is GNU 10.1.0
– Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
– Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Auto-configuring bsoncxx to use MNMLSTC for polyfills since C++17 is inactive
bsoncxx version: 3.5.0
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 “C:/msys64/home/agovan/mongo-cxx-driver-r3.5.0/build/CMakeFiles/CMakeOutput.log”.

This is exceptionally puzzling. Can you post the contents of the files C:\mongo-c-driver\lib\cmake\bson-1.0-config.cmake and C:\mongo-c-driver\lib\cmake\libbson-1.0-config.cmake?

the directories are slightly different
C:\mongo-c-driver\lib\cmake\bson-1.0\bson-1.0-config.cmake has

include("${CMAKE_CURRENT_LIST_DIR}/bson-targets.cmake")

as the only line
and
C:\mongo-c-driver\lib\cmake\libbson-1.0\libbson-1.0-config.cmake has

# Copyright 2017 MongoDB Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

message(WARNING "This CMake target is deprecated.  Use 'mongo::bson_shared' instead.  Consult the example projects for further details.")

set (BSON_MAJOR_VERSION 1)
set (BSON_MINOR_VERSION 16)
set (BSON_MICRO_VERSION 2)
set (BSON_VERSION 1.16.2)


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was libbson-1.0-config.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################

set_and_check (BSON_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/libbson-1.0")

# We want to provide an absolute path to the library and we know the
# directory and the base name, but not the suffix, so we use CMake's
# find_library () to pick that up.  Users can override this by configuring
# BSON_LIBRARY themselves.
find_library (BSON_LIBRARY bson-1.0 PATHS "${PACKAGE_PREFIX_DIR}/lib" NO_DEFAULT_PATH)

set (BSON_LIBRARIES ${BSON_LIBRARY})

You installation seems to be fine.

Does MSYS require that you reference Windows paths in a particular way? For example, I recall that for Cygwin, I would sometimes have to refer to C:\foo as /cygrdive/c/foo or some programs would not be able to find it. Apart from that, I am not sure what the problem could be.