Windows build failure mongo-cxx-driver

Hello! I’ve compiled libmongocrypt and mongo-c-driver successfully for Windows10 using VS2019. Now, when I attempt to compile mongo-cxx-driver, I get this error:

GlenM@DESKTOP-5K7AURG MINGW64 ~/src/build-mongo-cxx-driver
$ CMAKE_PREFIX_PATH='c:/packages/libmongocrypt;c:/packages/libmongoc' cmake ../mongo-cxx-driver -DCMAKE_INSTALL_PREFIX=c:/packages/libmongocxx -DBSONCXX_POLY_USE_MNMLSTC=1 -DBUILD_VERSION=3.7.0
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- No build type selected, default is Release
-- The C compiler identification is MSVC 19.29.30147.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
bsoncxx version: 3.7.0
found libbson version 1.23.2
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
mongocxx version: 3.7.0
found libmongoc version 1.23.2
-- 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
-- Build files generated for:
--      build system: Visual Studio 16 2019
--      instance: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/GlenM/src/build-mongo-cxx-driver

GlenM@DESKTOP-5K7AURG MINGW64 ~/src/build-mongo-cxx-driver
$ cmake --build . --config Release
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking Build System
  Creating directories for 'EP_mnmlstc_core'
  Building Custom Rule C:/Users/GlenM/src/mongo-cxx-driver/src/bsoncxx/third_party/CMakeLists.txt
  Performing download step (git clone) for 'EP_mnmlstc_core'
  -- EP_mnmlstc_core download command succeeded.  See also C:/Users/GlenM/src/build-mongo-cxx-driver/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-download-*.log
  No update step for 'EP_mnmlstc_core'
  No patch step for 'EP_mnmlstc_core'
  Performing configure step for 'EP_mnmlstc_core'
  -- EP_mnmlstc_core configure command succeeded.  See also C:/Users/GlenM/src/build-mongo-cxx-driver/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-configure-*.log
  Performing build step for 'EP_mnmlstc_core'
  -- EP_mnmlstc_core build command succeeded.  See also C:/Users/GlenM/src/build-mongo-cxx-driver/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-build-*.log
  Performing install step for 'EP_mnmlstc_core'
  -- EP_mnmlstc_core install command succeeded.  See also C:/Users/GlenM/src/build-mongo-cxx-driver/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log
  Performing fix-includes step for 'EP_mnmlstc_core'
  Completed 'EP_mnmlstc_core'
  Building Custom Rule C:/Users/GlenM/src/mongo-cxx-driver/src/bsoncxx/CMakeLists.txt
  element.cpp
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,46): error C2146: syntax error: missing ';' before identifier 'and' [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_shared.vcxproj]
C:\Users\GlenM\src\mongo-cxx-driver\src\bsoncxx\..\bsoncxx/types.hpp(152): message : see reference to function template instantiation 'bool core::v1::operator ==<char,std::char_traits<char>>(core::v1::basic_string_view<char,std::char_traits<char>>,core::v1::basic_string_view<char,std::char_traits<char>>) noexcept' being compiled [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_shared.vcxproj]
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,46): error C2065: 'and': undeclared identifier [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_shared.vcxproj]
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,50): error C2146: syntax error: missing ';' before identifier 'lhs' [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_shared.vcxproj]
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,67): warning C4553: '==': result of expression not used; did you intend '='? [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_shared.vcxproj]
  Building Custom Rule C:/Users/GlenM/src/mongo-cxx-driver/src/bsoncxx/CMakeLists.txt
  element.cpp
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,46): error C2146: syntax error: missing ';' before identifier 'and' [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_testing.vcxproj]
C:\Users\GlenM\src\mongo-cxx-driver\src\bsoncxx\..\bsoncxx/types.hpp(152): message : see reference to function template instantiation 'bool core::v1::operator ==<char,std::char_traits<char>>(core::v1::basic_string_view<char,std::char_traits<char>>,core::v1::basic_string_view<char,std::char_traits<char>>) noexcept' being compiled [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_testing.vcxproj]
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,46): error C2065: 'and': undeclared identifier [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_testing.vcxproj]
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,50): error C2146: syntax error: missing ';' before identifier 'lhs' [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_testing.vcxproj]
C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\third_party\EP_mnmlstc_core-prefix\src\EP_mnmlstc_core\include\core/string.hpp(309,67): warning C4553: '==': result of expression not used; did you intend '='? [C:\Users\GlenM\src\build-mongo-cxx-driver\src\bsoncxx\bsoncxx_testing.vcxproj]

Seems like it’s an silly issue with the 3rd-party EP_mnlstc_core stuff – I get this error in both r3.7.0 and in git-master.

Surely there’s an easy fix for this?? Please :smiley:

Hi @Glen_Mabey ,

If you are OK building with C++17, you can avoid choosing a polyfill (and relying on EP_mnmlstc_core)
See the instructions here - Getting Started with MongoDB and C++ | MongoDB

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.