Skip to content

Conversation

@eramongodb
Copy link
Contributor

Resolves CXX-3180 following DEVPROD-20813 and #1512. Verified by this patch.

This PR implements mingw-w64 GCC task coverage on Windows. This is in preparation for the followup resolution of CXX-2973 for pkg-config task coverage.


Most of the changes in this PR deal with consistently communicating the different CMake generators and toolchains to use when configuring and building example projects:

  • example_projects_(cc|cxx): reuse CC (cc_compiler) and CXX (cxx_compiler) instead.
  • example_projects_cxx_standard: reuse REQUIRED_CXX_STANDARD instead (default to minimum of 11 when unset).
  • CMAKE_GENERATOR(_PLATFORM): reuse generator and platform instead (same as compile task).

Compile and link flags specific to example projects are still specified by example_projects_(cxxflags|ldflags).

The build.sh scripts are simplified to work regardless of CMake generator or toolchain. However, special-casing by single (non-Windows) vs. multi-config (Windows) generators is still necessary to avoid "unused by this project" warnings when specifying -DCMAKE_BUILD_TYPE=<config>.

Additional notes:

  • libmongocrypt is pinned to a commit in the upcoming 1.17.1 / 1.18.0 release due to Use POSIX on Windows when building with mingw-w64 toolchain libmongocrypt#1098.
  • Cannot build libmongocrypt using the usual build script helpers (i.e. compile-libmongocrypt.sh) due to hardcoded flags which assume MSVC on Windows.
  • Linking the test_driver.exe executable alone can take up to 6 minutes (30% of task execution time)...! Unsure how to improve/avoid this behavior yet.
  • Extended CMake max policy for test, example, and CMake compatibility projects to 4.99 to avoid requiring bumps with each new CMake minor release.
  • Use -Wa,-mbig-obj as the mingw-w64 GCC equivalent to MSVC /bigobj (followup to Split collection_mocked.cpp test case into smaller functions #1509). Applied to all test executables.
  • Removed unused vs_ver property for EVG distro definitions.

Finally, there is a consistent and ongoing EVG task failure for CSFLE tests with server 4.2 with mingw-w64 GCC due to errors of the following form (output is edited for readability):

src\mongocxx\test\spec\util.cpp:434: failed: explicitly with 4 messages:
  - 'Test path: data/client_side_encryption/legacy/awsTemporary.json'
  - 'Operation: {
      "name" : "insertOne",
      "arguments" : {
        "document" : { "_id" : 1, "encrypted_string" : "string0" } }
    }'
  - 'server_error := {
      "nInserted" : 0,
      "nMatched" : 0,
      "nModified" : 0,
      "nRemoved" : 0,
      "nUpserted" : 0,
      "writeErrors" : [ ]
    }'
  - 'unexpected exception: mongocryptd error: No suitable servers found: `serverSelectionTimeoutMS` expired: [connection refused calling hello on 'localhost:27020']. Topology type: Single: generic server error'
src\mongocxx\test\spec\util.cpp:431: failed:
  - test_util::tolowercase(error_msg).find(error_contains) < error_msg.length()
    - for: 18446744073709551615 (0xffffffffffffffff) < 182
  - with 4 messages:
    - 'Test path: data/client_side_encryption/legacy/awsTemporary.json'
    - 'Operation: { "name" : "insertOne", "arguments" : { "document" : { "_id" : 1, "encrypted_string" : "string0" } }, "result" : { "errorContains" : "security token" } }'
    - 'expected error message security token'
    - 'got: mongocryptd error: No suitable servers found: `serverSelectionTimeoutMS` expired: [connection refused calling hello on 'localhost:27020']. Topology type: Single: generic server error'

It is yet unclear to me why this error manifests only with mingw-w64 GCC on Windows. Perhaps there may be a cipher suite compatibility issue similar to CDRIVER-5998 or CDRIVER-4530?

@eramongodb eramongodb requested a review from kevinAlbs December 8, 2025 21:33
@eramongodb eramongodb self-assigned this Dec 8, 2025
@eramongodb eramongodb requested a review from a team as a code owner December 8, 2025 21:34
if [[ "${SKIP_INSTALL_LIBMONGOCRYPT:-}" != "1" ]]; then
{
echo "Installing libmongocrypt into ${mongoc_dir}..." 1>&2
echo "Installing libmongocrypt into ${mongoc_dir}..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: but suggest using variable used for install path (which currently appears to have the same as ${mongoc_dir})

Suggested change
echo "Installing libmongocrypt into ${mongoc_dir}..."
echo "Installing libmongocrypt into ${mongoc_install_dir}..."

# Windows x86_64: 4.2+.
('windows-vsCurrent', 'vs2022x64', ['Debug'], ['shared'], [11, 17], [None], ['plain', 'csfle'], ['4.2', '8.0', 'latest'], ['single', 'replica', 'sharded']),
('windows-vsCurrent', 'vs2022x64', ['Debug'], ['shared'], [11, 17], [None], ['plain', 'csfle'], ['4.2', '8.0', 'latest'], ['single', 'replica', 'sharded']),
('windows-2022-latest', 'gcc', ['Debug'], ['shared'], [11, 17], [None], ['plain', 'csfle'], ['4.2', '8.0', 'latest'], ['single', 'replica', 'sharded']),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, there is a consistent and ongoing EVG task failure for CSFLE tests with server 4.2 with mingw-w64 GCC

The "connection refused" makes me think this is a failure to connect over TCP. Idea: this may be from mongocryptd failing to spawn (maybe related to the form of MONGOCRYPTD_PATH?). But I am not sure why that would be specific to version 4.2.

Regardless: I think csfle on MinGW test coverage can be added in the future (I expect it may be more valuable testing in the C driver, since the platform specific CSFLE code is likely limited to the C driver + libmongocrypt).

@eramongodb eramongodb merged commit 93e2b8c into mongodb:master Dec 11, 2025
13 of 15 checks passed
@eramongodb eramongodb deleted the cxx-3180 branch December 11, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants