Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-891

Fix MinGW build

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • 1.3.1
    • 1.1.2
    • libbson, mingw
    • None
    • Windows, using MinGW-w64

    Description

      The build system for libbson and libmongoc must keep straight the distinction between "compiling on Windows" and "compiling with Microsoft Visual C". There are many ifdefs that check for BSON_OS_WIN32 and then include MSVC-specific code. This breaks under MinGW since BSON_OS_WIN32 is true in MinGW but mostly, compiling with MinGW is the same as compiling on Unix.

      Most ifdefs that currently check for BSON_OS_WIN32 should instead check for _MSC_VER to

      ------

      Original report:

      bson-stdint.h not found when using MinGW:

      The bson.h requires including bson-stdint.h which is renamed to bson-stdint-win32.h on Windows.

      This is because the _MSC_VER is not defined (and is only defined with MSVC).

      I propose to change the following code :

      #ifdef _MSC_VER
      # include "bson-stdint-win32.h"
      // ... as before
      

      to something like this :

      #if defined(_WIN32)
      #  include "bson-stdint.h-win32.h"
      #endif
       
      #if defined(_MSC_VER)
      // ... as before specific for MSVC
      #endif
      

      Attachments

        Activity

          People

            jesse@mongodb.com A. Jesse Jiryu Davis
            markand Demelier David
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: