[CDRIVER-2826] Compiling with ENABLE_SRV=OFF broken on Windows Created: 14/Sep/18  Updated: 28/Oct/23  Resolved: 18/Sep/18

Status: Closed
Project: C Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 1.13.0, 1.14.0

Type: Bug Priority: Major - P3
Reporter: Henrik Edin Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Was trying to setup a MongoDB Embedded builder for Windows and got the following compilation error when building for Windows:

ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /I"C:\data\mongo-c-driver-1.12.0\src\libbson\src\bson" /I"C:\data\mongo-c-driver-1.12.0\src\libmongoc\src\mongoc" /I"C:\data\mongo-c-driver-1.12.0\src\libmongoc\..\..\src\common" /Zi /nologo /W3 /WX- /O2 /Ob1 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG /D MONGOC_COMPILATION /D _CRT_SECURE_NO_WARNINGS /D _GNU_SOURCE /D _BSD_SOURCE /D _DEFAULT_SOURCE /D "CMAKE_INTDIR=\"RelWithDebInfo\"" /D mongoc_shared_EXPORTS /D _WINDLL /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"mongoc_shared.dir\RelWithDebInfo\\" /Fd"mongoc_shared.dir\RelWithDebInfo\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\data\mongo-c-driver-1.12.0\src\libmongoc\src\mongoc\mongoc-client.c"
  mongoc-client.c
C:\data\mongo-c-driver-1.12.0\src\libmongoc\src\mongoc\mongoc-client.c(26): fatal error C1083: Cannot open include file: 'netdb.h': No such file or directory [C:\data\mongo-c-driver-1.12.0\src\libmongoc\mongoc_shared.vcxproj]
Done Building Project "C:\data\mongo-c-driver-1.12.0\src\libmongoc\mongoc_shared.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\data\mongo-c-driver-1.12.0\src\libmongoc\mongoc-stat.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\data\mongo-c-driver-1.12.0\ALL_BUILD.vcxproj" (default targets) -- FAILED.

We are passing the following flags to CMake:
-DENABLE_SHM_COUNTERS=OFF
-DENABLE_SNAPPY=OFF
-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF
-DENABLE_ZLIB=OFF
-DENABLE_SSL=OFF
-DENABLE_SASL=OFF
-DENABLE_TESTS=OFF
-DENABLE_SRV=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_STATIC=OFF

By looking at the code, it seems like -DENABLE_SRV=OFF is the culprit. There's currently no test coverage for this on Evergreen (should probably be added).



 Comments   
Comment by Githook User [ 18/Sep/18 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: CDRIVER-2826 test ENABLE_SRV=OFF in evergreen
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/834b9999b6483e3e1cf1eaf66c886dce78346d9b

Comment by A. Jesse Jiryu Davis [ 17/Sep/18 ]

In 1.13 or 1.14, we should test this build configuration in Evergreen.

Comment by Githook User [ 17/Sep/18 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: CDRIVER-2826 Possible to build with ENABLE_SRV=OFF on Windows.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/47d0f7eb3dfd16f37e21504a8ec36bc21eb28ed4

Generated at Wed Feb 07 21:16:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.