[CDRIVER-4376] Build errors on Windows when missing C99 features Created: 02/May/22 Updated: 10/Jun/22 Resolved: 17/May/22 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 1.21.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Agostino Sturaro | Assignee: | Kevin Albertson |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
SummaryThere are issues building with Visual Studio 2012 and quite likely other compilers not supporting certain C99 features. The issues caused by stdbool.h not being defined are easy to fix. For other issues, I only have a partial solution. EnvironmentI'm using:
Visual Studio 2012 is not in the continuous build, but it is supported according to the doc
How to ReproduceDownload https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.21.1.zip Create a new folder C:\MyTempDir\mongo-c-driver\cmake-VS2012-x64
This is the cmake output: cmake build log.txt — This fix is part of PR 980. Open C:\MyTempDir\mongo-c-driver\cmake-VS2012-x64\mongo-c-driver.sln Notice several errors like the following one
This is due to a broken BSON_HAVE_STDBOOL_H macro definition.
with this line
The missing 0 in the macro is caused to a defect in a cmake script.
add these lines
Build the bson_static project again. — This fix is also part of PR 980. Build the mongoc_static project. There are several errors. Among them, notice this one
This is due to an include <stdbool.h> with no fallback. To fix the issue, open C:\MyTempDir\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-timeout-private.h
with this one
By the way, a few files in C:\MyTempDir\mongo-c-driver\src\kms-message\src have the same issue and can be fixed the same way. — The following issues are not due to missing stdbool.h. Build the mongoc_static project again. There are several errors like the following one
This is due to the mc_tpld_take_ref function using an unsupported syntax.
with these lines
— Build the mongoc_static project again. Notice these errors
They are due to the MONGOC_SHARED_PTR_NULL macro using an unsupported syntax.
With this line
Then, open C:\MyTempDir\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-shared.c
with this line
Replace this line
with this line
— Build the mongoc_static project again. The following errors remain
I don't know how to fix them. |
| Comments |
| Comment by Agostino Sturaro [ 19/May/22 ] |
|
Could you please remove my email address from your message? |
| Comment by Githook User [ 17/May/22 ] |
|
Author: {'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}Message: |
| Comment by Kevin Albertson [ 17/May/22 ] |
|
Hello, thank you for the detailed report. The C driver stopped testing compile in Visual Studio versions older than 2013 in the 1.17.0 release. The documentation noting Visual Studio 2010 is supported is outdated and will be updated to note that 2013 is required. We do not plan to add support back Visual Studio 2010. |