[CDRIVER-3776] Windows VS2019 compile warnings in libbson Created: 12/Aug/20 Updated: 28/Oct/23 Resolved: 28/Mar/23 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libbson |
| Affects Version/s: | None |
| Fix Version/s: | 1.24.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Shane Harvey | Assignee: | Ezra Chung |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Epic Link: | CDRIVER-4546 | ||||||||||||
| Description |
|
As noted in https://github.com/mongodb-labs/python-bsonjs/issues/23, I see the following compile warnings in libbson 1.17.0 on Windows when building with VS2019:
|
| Comments |
| Comment by Ezra Chung [ 28/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
Addressed by | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 28/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
Yes that's correct. Thanks ezra.chung@mongodb.com! | |||||||||||||||||||||||||||||||||||
| Comment by Ezra Chung [ 28/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
Regarding warnings advising use of strcpy_s, we have opted to define _CRT_SECURE_NO_WARNINGS for the entire project as instructed to disable deprecation, so I do not think addressing this will be a priority for us. I suggest adding the flag to the compile options if able. If I understand the situation correctly, this means with the exception of warnings triggered by the missing _CRT_SECURE_NO_WARNINGS compile definition, all the VS 2019 warnings initially reported should have been addressed. Can you confirm if this is the case? If so, I will close this ticket as completed and defer addressing the GCC and Clang warnings to CDRIVER-3777. | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
python-bsonjs vendors libbson in a hacky way. It copies the libbson source and attempts to rely on Python.h for portability and setuptools to automatically compile the source into a Python C extension. The alternative is to build libbson the correct way and then bundle the library in the release wheels (like we do in https://github.com/mongodb-labs/mongo-arrow/). Perhaps we should finally make that switch. | |||||||||||||||||||||||||||||||||||
| Comment by Ezra Chung [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
Yes. It looks like there are many compilation flags that are expected by the C Driver (per its CMakeLists.txt files) that are not being included in the compilation commands listed above, `-std=c99` being among them (see | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
The only remaining windows warnings are:
and
But there are still other warnings from clang and gcc as I pointed out above. | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
I found the issue. python-bsonjs sets BSON_HAVE_STDBOOL_H=0. If I set it to 1 this error goes away. Is that expected? | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
I can reproduce the same bson-iso8601.c error locally on macos:
It compiles without warning or errors with 1.20.0:
| |||||||||||||||||||||||||||||||||||
| Comment by Ezra Chung [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
Thank you. The remaining warnings should be easily addressable. However, that last error concerning _bson_iso8601_date_parse does not make sense. That function's declaration has not been recently modified. Can you double-check if the error is still present given a clean build? | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
I see these warnings and a new error, see https://github.com/mongodb-labs/python-bsonjs/pull/47:
| |||||||||||||||||||||||||||||||||||
| Comment by Ezra Chung [ 27/Mar/23 ] | |||||||||||||||||||||||||||||||||||
|
shane.harvey@mongodb.com Can you confirm what errors remain if any after c41c3a8c ( | |||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 03/Feb/22 ] | |||||||||||||||||||||||||||||||||||
|
Here are the current warnings with libbson 1.20.0 https://github.com/mongodb-labs/python-bsonjs/runs/4733813334?check_suite_focus=true#step:5:61:
Note we're vendoring and building libbson in a hacky way (hard coding some of bson-config.h) without using cmake or ./configure so some of these errors might not be reproducible for you. |