Opened 9 years ago
Closed 6 years ago
#9305 closed Bugs (obsolete)
Errors when building Boost with MinGW
Reported by: | Owned by: | Andrey Semashev | |
---|---|---|---|
Milestone: | Boost 1.55.0 | Component: | winapi |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
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)
Change History (2)
comment:1 by , 6 years ago
Component: | Building Boost → winapi |
---|---|
Owner: | set to |
comment:2 by , 6 years ago
Resolution: | → obsolete |
---|---|
Status: | new → closed |
Please, try the latest version from git and create a new ticket if the problem still exists.