Subject: [Boost-bugs] [Boost C++ Libraries] #9305: Errors when building Boost with MinGW
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-25 23:05:31
#9305: Errors when building Boost with MinGW
--------------------------------+-------------------------------------
Reporter: Ben Key <BKey76@â¦> | Type: Bugs
Status: new | Milestone: Boost 1.55.0
Component: Building Boost | Version: Boost Development Trunk
Severity: Problem | Keywords:
--------------------------------+-------------------------------------
When building the latest Boost SVN with MinGW I am getting the following
errors.
./boost/detail/winapi/thread_pool.hpp: At global scope:
./boost/detail/winapi/thread_pool.hpp:30:9: error:
'::RegisterWaitForSingleObjectEx' has not been declared
using ::RegisterWaitForSingleObjectEx;
./boost/sync/detail/waitable_timer.hpp: In member function 'void
boost::sync::detail::windows::waitable_timer_state::init()':
./boost/sync/detail/waitable_timer.hpp:169:26: error: 'OpenSemaphoreA' is
not a member of 'boost::detail::winapi'
tls_key_holder = boost::detail::winapi::OpenSemaphoreA
The solution to the OpenSemaphoreA error is to simply add the following
line to boost\detail\winapi\synchronization.hpp.
using ::OpenSemaphoreA;
I added it immediately after the "using ::CreateSemaphoreA;" line.
The solution to the RegisterWaitForSingleObjectEx error is a little more
complicated. There is a bug in the mingw-w64 version of winbase.h. It does
not define RegisterWaitForSingleObjectEx. The solution is to replace the
"using ::RegisterWaitForSingleObjectEx;" line with the following,
#if defined(__MINGW32__)
/* Work around a bug in the mingw-w64 version of winbase.h which does not
define RegisterWaitForSingleObjectEx */
WINBASEAPI HANDLE WINAPI
RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG);
#else
using ::RegisterWaitForSingleObjectEx;
#endif
The following patch resolves these issues and an issue with the bootstrap
process I reported earlier,
Index: boost/detail/winapi/synchronization.hpp
===================================================================
--- boost/detail/winapi/synchronization.hpp (revision 86431)
+++ boost/detail/winapi/synchronization.hpp (working copy)
@@ -60,6 +60,7 @@
using ::CreateEventA;
using ::OpenEventA;
using ::CreateSemaphoreA;
+ using ::OpenSemaphoreA;
# endif
using ::ReleaseMutex;
using ::ReleaseSemaphore;
Index: boost/detail/winapi/thread_pool.hpp
===================================================================
--- boost/detail/winapi/thread_pool.hpp (revision 86431)
+++ boost/detail/winapi/thread_pool.hpp (working copy)
@@ -27,7 +27,12 @@
typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_;
using ::RegisterWaitForSingleObject;
+#if defined(__MINGW32__)
+/* Work around a bug in the mingw-w64 version of winbase.h which does not
define RegisterWaitForSingleObjectEx */
+WINBASEAPI HANDLE WINAPI
RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG);
+#else
using ::RegisterWaitForSingleObjectEx;
+#endif
using ::UnregisterWait;
using ::UnregisterWaitEx;
Index: tools/build/v2/engine/builtins.c
===================================================================
--- tools/build/v2/engine/builtins.c (revision 86431)
+++ tools/build/v2/engine/builtins.c (working copy)
@@ -31,6 +31,7 @@
#ifdef OS_NT
#include <windows.h>
+#include <winioctl.h>
#endif
#if defined(USE_EXECUNIX)
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9305> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC