[thread] Trying to cross build 1.64.0 boost.thread with mingw posix threads
I built a w64 cross-compiler to make windows binaries on linux. The
cross-compiler has Posix threads, not win32 threads. I would like to
build boost.thread with it but I have some difficulties:
1. I do not need to link with any library to build applications with
C++11 threads but boost build asks for PTW32_INCLUDE and PTW32_LIB
otherwise it sets <build>no so that the library is not built. This is
easily changed with the following patch:
2. Once this patch is applied, the library is built but there are
errors when compiling libs/thread/src/pthread/thread.cpp. The command
that is run by b2 is given below. Here are the errors:
libs/thread/src/pthread/thread.cpp:541:2: error: #error
In file included from ./boost/thread/thread_only.hpp:17:0,
./boost/thread/pthread/thread_data.hpp: In member function ‘void
./boost/thread/pthread/thread_data.hpp:53:35: error: ‘getpagesize’ was
not declared in this scope
std::size_t page_size = getpagesize();
The first error is because apparently neither BOOST_HAS_SCHED_YIELD
nor BOOST_HAS_PTHREAD_YIELD is defined.
I understand that the 2nd error comes from the fact that getpagesize()
is not in unistd.h provided by mingw-w64.
There is a strange thing about the command line: it contains -mthreads
although I never provided it. I tried to remove it or replace it with
-pthread or -lptread but I still get the same error message.