I’m trying to install MongoDB-C-driver and MongoDB-Cxx-Drivers both using visual studio andn cmake but running into a lot of errors when trying to run the cmake build:
I’ve included the terminal output going through the build step and the install step as well as the first chunk of the errors that were popping up (note: the terminal reached 100+ errors and force stopped the compilation)
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:Reposmongo-c-driver-1.27.2> cmake -G "Visual Studio 17 2022" -A x64 -S "C:Reposmongo-c-driver-1.27.2" -B "C:Reposmongo-c-driver-1.27.2cmake-build"
-- Found Python: C:/Users/tulip/AppData/Local/Programs/Python/Python312/python.exe (found version "3.12.1") found components: Interpreter
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.38.33133.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Looking for a CXX compiler
-- Looking for a CXX compiler - C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
-- The CXX compiler identification is MSVC 19.38.33133.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: C:/Users/tulip/AppData/Local/Programs/Python/Python312/python.exe (found version "3.12.1") found components: Interpreter
-- Using bundled libbson
-- Looking for snprintf
-- Looking for snprintf - found
-- Performing Test BSON_HAVE_TIMESPEC
-- Performing Test BSON_HAVE_TIMESPEC - Success
-- 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 - not found
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Looking for clock_gettime
-- Looking for clock_gettime - not found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for sched_getcpu
-- Looking for sched_getcpu - not found
-- libmongoc version (from VERSION_CURRENT file): 1.27.2
-- Enabling zlib compression (bundled)
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Looking for include file stdarg.h
-- Looking for include file stdarg.h - found
-- Searching for compression library zstd
-- Found PkgConfig: C:/msys64/ucrt64/bin/pkg-config.exe (found version "2.1.0")
-- Checking for module 'libzstd'
-- Found libzstd, version 1.5.5
-- Found zstd version 1.5.5 in C:/msys64/ucrt64/bin/../include
-- libmongoc TLS : SecureChannel
-- Using SASL backend : SSPI
-- 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 socklen_t
-- Check size of socklen_t - done
-- Searching for compression library header snappy-c.h
-- Not found (specify -DCMAKE_INCLUDE_PATH=/path/to/snappy/include for Snappy compression)
-- Searching for libmongocrypt
-- libmongocrypt not found. Configuring without In-Use Encryption support.
-- Performing Test MONGOC_HAVE_SS_FAMILY
-- Performing Test MONGOC_HAVE_SS_FAMILY - Failed
-- Compiling against Windows SSPI
-- Enabling utf8proc (bundled)
-- Building with MONGODB-AWS auth support
-- Build files generated for:
-- build system: Visual Studio 17 2022
-- instance: C:/Program Files/Microsoft Visual Studio/2022/Community
-- instance: x64
-- The following features have been enabled:
* TLS, for secure network communication (SecureChannel)
* Cryptography, cryptographic primitives (SecureChannel)
* AWS Authentication, authenticate with MongoDB servers using credentials from AWS instance metadata
* SASL Authentication, authenticate with MongoDB servers using SASL: “Simple Authentication and Security Layer” (SSPI)
-- Configuring done (14.1s)
-- Generating done (0.4s)
-- Build files have been written to: C:/Repos/mongo-c-driver-1.27.2/cmake-build
PS C:Reposmongo-c-driver-1.27.2> cmake --build . --config RelWithDebInfo --target install
Error: could not load cache
PS C:Reposmongo-c-driver-1.27.2> cd .cmake-build
PS C:Reposmongo-c-driver-1.27.2cmake-build> cmake --build . --config RelWithDebInfo --target install
MSBuild version 17.8.3+195e7f5a3 for .NET Framework
Checking File Globs
1>Checking Build System
Building Custom Rule C:/Repos/mongo-c-driver-1.27.2/src/libmongoc/CMakeLists.txt
utf8proc.c
C:msys64ucrt64includestdlib.h(389,32): error C2085: '_exit': not in formal parameter list [C:Reposmongo-c-driver-
1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(389,49): error C2143: syntax error: missing ';' before 'type' [C:Reposmongo-c-drive
r-1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(391,32): error C2085: 'quick_exit': not in formal parameter list [C:Reposmongo-c-dr
iver-1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(391,54): error C2143: syntax error: missing ';' before 'type' [C:Reposmongo-c-drive
r-1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(396,16): error C2085: '_Exit': not in formal parameter list [C:Reposmongo-c-driver-
1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(396,27): error C2143: syntax error: missing ';' before 'type' [C:Reposmongo-c-drive
r-1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(398,54): error C2085: '_Exit': not in formal parameter list [C:Reposmongo-c-driver-
1.27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
C:msys64ucrt64includestdlib.h(399,3): error C2143: syntax error: missing ';' before '{' [C:Reposmongo-c-driver-1.
27.2cmake-buildsrclibmongocutf8proc_obj.vcxproj]
(compiling source file '../../../src/utf8proc-2.8.0/utf8proc.c')
https://www.mongodb.com/developer/products/mongodb/getting-started-mongodb-cpp/
I’ve been following the above guide as closely as I can, but after generating the cmake build I can’t get it to install and I’m completely lost as to what the problem is because the errors seem to be within either the source code (which I doubt) or cmake’s generated build, and I don’t know how to fix it to get it to run. As far as I can tell, I have all the prerequisites that should allow this to run and install smoothly.
coffee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.