Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1295

Provide clearer error message to users when attempting to link x86 libmongocxx against x64 libmongoc with MSVC

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: