StephanTLavavej / mingw-distro

MinGW distro build scripts.
494 stars 55 forks source link

Boost.Fiber tries to use std::mutex which MinGW doesn't have #28

Closed StephanTLavavej closed 7 years ago

StephanTLavavej commented 7 years ago

Boost.Fiber, added in 1.62.0, is incorrectly detecting the availability of std::mutex, which MinGW doesn't natively support. It should fall back to using boost::mutex etc.

I currently have to disable Boost.Fiber so it doesn't break the build.

StephanTLavavej commented 7 years ago

1.63.0 RC1 is still affected, despite the build detecting - C++11 mutex : no with the full output:

Performing configuration checks

    - 32-bit                   : no
    - 64-bit                   : yes
    - arm                      : no
    - mips1                    : no
    - power                    : no
    - sparc                    : no
    - x86                      : yes
    - symlinks supported       : no
    - junctions supported      : yes
    - hardlinks supported      : yes
    - C++11 mutex              : no
    - Boost.Config Feature Check: cxx11_auto_declarations : yes
    - Boost.Config Feature Check: cxx11_constexpr : yes
    - Boost.Config Feature Check: cxx11_defaulted_functions : yes
    - Boost.Config Feature Check: cxx11_final : yes
    - Boost.Config Feature Check: cxx11_hdr_tuple : yes
    - Boost.Config Feature Check: cxx11_lambdas : yes
    - Boost.Config Feature Check: cxx11_noexcept : yes
    - Boost.Config Feature Check: cxx11_nullptr : yes
    - Boost.Config Feature Check: cxx11_rvalue_references : yes
    - Boost.Config Feature Check: cxx11_template_aliases : yes
    - Boost.Config Feature Check: cxx11_thread_local : yes
    - Boost.Config Feature Check: cxx11_variadic_templates : yes
    - has_icu builds           : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
    - zlib                     : yes
    - bzip2                    : yes
    - iconv (libc)             : no
    - iconv (separate)         : no
    - icu                      : no
    - icu (lib64)              : no
    - native-atomic-int32-supported : yes
    - message-compiler         : no
    - native-syslog-supported  : no
    - pthread-supports-robust-mutexes : no
    - compiler-supports-visibility : yes
    - compiler-supports-ssse3  : yes
    - compiler-supports-avx2   : yes
    - gcc visibility           : yes
    - long double support      : yes
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
warning: No python installation configured and autoconfiguration
note: failed.  See http://www.boost.org/libs/python/doc/building.html
note: for configuration instructions or pass --without-python to
note: suppress this message and silently skip all Boost.Python targets
StephanTLavavej commented 7 years ago

And here's a failing TU:

gcc.compile.c++ bin.v2\libs\fiber\build\gcc-mingw-6.2.0\release\link-static\runtime-link-static\threading-multi\algo\round_robin.o
In file included from ./boost/fiber/detail/spinlock.hpp:16:0,
                 from ./boost/fiber/detail/data.hpp:13,
                 from ./boost/fiber/context.hpp:29,
                 from ./boost/fiber/algo/round_robin.hpp:16,
                 from libs\fiber\src\algo\round_robin.cpp:7:
./boost/fiber/detail/spinlock_ttas.hpp: In member function 'void boost::fibers::detail::spinlock_ttas::lock()':
./boost/fiber/detail/spinlock_ttas.hpp:74:26: error: 'std::this_thread' has not been declared
                     std::this_thread::sleep_for( us0);
                          ^~~~~~~~~~~
./boost/fiber/detail/spinlock_ttas.hpp:79:26: error: 'std::this_thread' has not been declared
                     std::this_thread::yield();
                          ^~~~~~~~~~~
In file included from ./boost/fiber/detail/spinlock.hpp:17:0,
                 from ./boost/fiber/detail/data.hpp:13,
                 from ./boost/fiber/context.hpp:29,
                 from ./boost/fiber/algo/round_robin.hpp:16,
                 from libs\fiber\src\algo\round_robin.cpp:7:
./boost/fiber/detail/spinlock_ttas_adaptive.hpp: In member function 'void boost::fibers::detail::spinlock_ttas_adaptive::lock()':
./boost/fiber/detail/spinlock_ttas_adaptive.hpp:78:26: error: 'std::this_thread' has not been declared
                     std::this_thread::sleep_for( us0);
                          ^~~~~~~~~~~
./boost/fiber/detail/spinlock_ttas_adaptive.hpp:83:26: error: 'std::this_thread' has not been declared
                     std::this_thread::yield();
                          ^~~~~~~~~~~
In file included from libs\fiber\src\algo\round_robin.cpp:7:0:
./boost/fiber/algo/round_robin.hpp: At global scope:
./boost/fiber/algo/round_robin.hpp:38:10: error: 'mutex' in namespace 'std' does not name a type
     std::mutex                  mtx_{};
          ^~~~~
./boost/fiber/algo/round_robin.hpp:39:10: error: 'condition_variable' in namespace 'std' does not name a type
     std::condition_variable     cnd_{};
          ^~~~~~~~~~~~~~~~~~
libs\fiber\src\algo\round_robin.cpp: In member function 'virtual void boost::fibers::algo::round_robin::suspend_until(const time_point&)':
libs\fiber\src\algo\round_robin.cpp:47:27: error: 'mutex' is not a member of 'std'
         std::unique_lock< std::mutex > lk( mtx_);
                           ^~~
libs\fiber\src\algo\round_robin.cpp:47:27: error: 'mutex' is not a member of 'std'
libs\fiber\src\algo\round_robin.cpp:47:38: error: template argument 1 is invalid
         std::unique_lock< std::mutex > lk( mtx_);
                                      ^
libs\fiber\src\algo\round_robin.cpp:47:44: error: 'mtx_' was not declared in this scope
         std::unique_lock< std::mutex > lk( mtx_);
                                            ^~~~
libs\fiber\src\algo\round_robin.cpp:48:9: error: 'cnd_' was not declared in this scope
         cnd_.wait( lk, [&](){ return flag_; });
         ^~~~
libs\fiber\src\algo\round_robin.cpp:51:27: error: 'mutex' is not a member of 'std'
         std::unique_lock< std::mutex > lk( mtx_);
                           ^~~
libs\fiber\src\algo\round_robin.cpp:51:27: error: 'mutex' is not a member of 'std'
libs\fiber\src\algo\round_robin.cpp:51:38: error: template argument 1 is invalid
         std::unique_lock< std::mutex > lk( mtx_);
                                      ^
libs\fiber\src\algo\round_robin.cpp:51:44: error: 'mtx_' was not declared in this scope
         std::unique_lock< std::mutex > lk( mtx_);
                                            ^~~~
libs\fiber\src\algo\round_robin.cpp:52:9: error: 'cnd_' was not declared in this scope
         cnd_.wait_until( lk, time_point, [&](){ return flag_; });
         ^~~~
libs\fiber\src\algo\round_robin.cpp: In member function 'virtual void boost::fibers::algo::round_robin::notify()':
libs\fiber\src\algo\round_robin.cpp:59:23: error: 'mutex' is not a member of 'std'
     std::unique_lock< std::mutex > lk( mtx_);
                       ^~~
libs\fiber\src\algo\round_robin.cpp:59:23: error: 'mutex' is not a member of 'std'
libs\fiber\src\algo\round_robin.cpp:59:34: error: template argument 1 is invalid
     std::unique_lock< std::mutex > lk( mtx_);
                                  ^
libs\fiber\src\algo\round_robin.cpp:59:40: error: 'mtx_' was not declared in this scope
     std::unique_lock< std::mutex > lk( mtx_);
                                        ^~~~
libs\fiber\src\algo\round_robin.cpp:61:8: error: request for member 'unlock' in 'lk', which is of non-class type 'int'
     lk.unlock();
        ^~~~~~
libs\fiber\src\algo\round_robin.cpp:62:5: error: 'cnd_' was not declared in this scope
     cnd_.notify_all();
     ^~~~

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthreads -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_DISABLE_ASSERTS -DBOOST_FIBERS_SOURCE -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_USE_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\fiber\build\gcc-mingw-6.2.0\release\link-static\runtime-link-static\threading-multi\algo\round_robin.o" "libs\fiber\src\algo\round_robin.cpp"

...failed gcc.compile.c++ bin.v2\libs\fiber\build\gcc-mingw-6.2.0\release\link-static\runtime-link-static\threading-multi\algo\round_robin.o...