[CXX-1295] Provide clearer error message to users when attempting to link x86 libmongocxx against x64 libmongoc with MSVC Created: 04/Apr/17  Updated: 29/Sep/23

Status: Backlog
Project: C++ Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: J Rassi Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CXX-1286 building mongodbcxx on Windows Closed
Epic Link: C++ Error Improvements
Quarter: FY24Q4

 Description   

Currently, when users attempt to link an x86 build of libmongocxx to an x64 build of libmongoc with MSVC, the linker reports several dozen unhelpful unresolved symbol errors and one helpful warning, which gets drowned out in the noise.

Example unhelpful error:

error LNK2019: unresolved external symbol __imp__bson_append_undefined referenced in function "public: void __thiscall bsoncxx::v_noabi::builder::core::append(struct bsoncxx::v_noabi::types::b_undefined const &)"

Example helpful warning:

warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'

Users commonly run into this issue when building on x64 machines where they fail to pass -G "Visual Studio 14 2015 Win64" to cmake when building mongocxx. On these machines, the default CMake generator is often "Visual Studio 14 2015" (an x86 generator).

It would be helpful to detect this condition earlier in the build process (during time of cmake execution?) and to present a readable error message to the user explaining how to fix the issue.


Generated at Wed Feb 07 22:02:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.