Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4075

Better MinGW support for headers-only boost (without thread library)

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Labels:
      None
    • Environment:

      MingW 5.3 / QtCreator (CMake)

    • Patch Info:
      Patch Available
    • Flags:
      Patch

      Description

      Hello,

      I am building Thrift on Windows with QtCreator as a front-end on top of CMake. I am using MingW 5.3 (Qt 5.7).

      I saw that you are working on improving the build experience on Windows with MingW (#THRIFT-4046) so here are my suggestions

      • The doc says Boost 1.53 is required, but actually Boost 1.63 works better because they fixed some issues preventing the use of Boost as header only
      • I was able to build Thrift with Boost as header only with very small changes. *Boost threads is not required* for MingW 5.3 (it should also work with MingW 4.9). This makes the build process much simpler because we just have to unzip the boost package and that's all.
      • Therefore you should consider passing -DWITH_BOOSTTHREADS=OFF in the README-MSYS2.md doc
      • boost/cstdint.hpp is not required (#define HAVE_STDINT_H)

      Here's the changes I made to thrift-0.10.0\lib\cpp\src\thrift\windows\config.h to better support MingW and make it possible to use boost as header only.

      Since I don't know how to attach a patch here, I'll do it old school

      Before :

      // use std::thread in MSVC11 (2012) or newer
      #if _MSC_VER >= 1700
      #define USE_STD_THREAD 1
      #else
      // otherwise use boost threads
      #define USE_BOOST_THREAD 1
      #endif
      
      // VS2010 or later has stdint.h
      #if _MSC_VER >= 1600
      #define HAVE_STDINT_H 1
      #endif
      

      After :

      // use std::thread in MSVC11 (2012) or newer
      #if defined(_MSC_VER) && (_MSC_VER >= 1700)
      #define USE_STD_THREAD 1
      
      #elif defined(__MINGW32__)
      #define USE_STD_THREAD 1
      
      #else
      // otherwise use boost threads
      #define USE_BOOST_THREAD 1
      #endif
      
      // VS2010 or later has stdint.h
      #if defined(_MSC_VER) && (_MSC_VER >= 1600)
      #define HAVE_STDINT_H 1
      
      #elif defined(__MINGW32__)
      #define HAVE_STDINT_H 1
      
      #endif
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jking3 James E. King III
                Reporter:
                aurelienrb Aurelien Regat-Barrel
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: