Installing Wt on MinGW » History » Revision 10
Revision 9 (Wim Dumon, 12/26/2013 03:50 PM) → Revision 10/11 (Checheta Yan, 01/08/2016 04:16 PM)
h1. Installing Wt on MinGW
h2. MinGW requirements
This guide used the TDM-gcc (4.5.1-tdm-4). Verified with TDM-gcc 4.7.1.
The procedure also works for mingwbuild for a 64bit target, after working around some compilation/linking issues.
h2. Build Boost
Instructions to build boost may vary slightly from release to release.
You can choose between the 'MinGW Command prompt' and the 'MSYS shell' (msys.bat) to build boost.
h3. From MSYS shell of the TDM-gcc installation:
<pre>
cd boost_1_52_0
./bootstrap.sh --with-toolset=mingw
</pre>
This builds boost. Then edit project-config.jam and do a search and replace, to replace all mingw in gcc.
Build boost (the context library does not compile on boost 1.52, may be fixed in newer versions):
<pre>
./bjam.exe toolset=gcc link=static threading=multi --layout=versioned --prefix=c:/Boost --without-context install
</pre>
h3. From the 'MinGW Command Prompt' of the TDM-gcc installation
Since bootstrap.bat will always use msvs to compile bjam, you need an installed MS Visual Studio compiler to use this method.
First, bootstrap boost
<pre>
cd boost_1_43_0
bootstrap.bat
</pre>
Before building boost, consider to apply the two patches provided below. These are bugs that may be fixed in future versions of boost and cygwin, but compilation of Wt failed whith boost 1.44 and TDM-gcc 4.5.1-tdm-4.
Build the required libraries
<pre>
bjam.exe toolset=gcc link=static threading=multi --layout=versioned --prefix=c:/Boost --without-context install
</pre>
It will take a while before boost is installed. If the boost.random library does not exist for your boost version, then simply omit it from the bjam command line.
h3. General remarks on boost
Note: If you get link errors with boost.thread, Tomasz Kalicki points out that you may want to fix the boost header files. This is not necessarily required for Wt versions newer than 3.1.5 as those will define BOOST_THREAD_USE_LIB when not linking to a dynamic boost (-DBOOST_DYNAMIC=OFF), but you may want to use it anyway if you use boost.thread in your own application.
<pre>
--- oldconfig.hpp 2010-07-09 20:13:09.000000000 +0200
+++ config.hpp 2010-09-16 11:11:48.000000000 +0200
@@ -37,7 +37,7 @@
#elif defined(BOOST_THREAD_USE_LIB) //Use lib
#else //Use default
# if defined(BOOST_THREAD_PLATFORM_WIN32)
-# if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN)
+# if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) || defined(__MINGW32__)
//For compilers supporting auto-tss cleanup
//with Boost.Threads lib, use Boost.Threads lib
# define BOOST_THREAD_USE_LIB
</pre>
See https://svn.boost.org/trac/boost/ticket/4614
When setting up your own makefiles for use with mingw, think about setting BOOST_THREAD_USE_LIB properly on your project if you do not apply this patch.
<pre>
--- libs/thread/src/win32/tss_pe.cpp.orig 2010-09-16 15:46:01.375000000 +0200
+++ libs/thread/src/win32/tss_pe.cpp 2010-09-16 15:46:53.906250000 +0200
@@ -54,6 +54,7 @@
PIMAGE_TLS_CALLBACK __crt_xl_end__ __attribute__ ((section(".CRT$XLZ"))) = 0;
}
+#if 0
extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata$T"))) =
{
(DWORD) &__tls_start__,
@@ -63,6 +64,7 @@
(DWORD) 0,
(DWORD) 0
};
+#endif
#elif defined(_MSC_VER) && !defined(UNDER_CE)
</pre>
See https://svn.boost.org/trac/boost/ticket/4258
h3. Build Wt
From MinGW Command Prompt:
<pre>
cmake c:/path/to/source/of/wt -G "MinGW Makefiles"
mingw32-make
</pre>
From MSYS unix-alike shell:
<pre>
cmake c:/path/to/source/of/wt -G "MSYS Makefiles"
make
</pre>
The Isapi connector is not built under MinGW because the httpext.h file provided with MinGW misses several declarations. I suspect that with a complete httpext.h header, it is possible to build the isapi connector without problems. "source":http://obuvvspb.ru
When setting up your own makefiles for use with mingw, think about setting BOOST_THREAD_USE_LIB properly on your project (see notes on boost above).