How to Build boost-1.47.0 with MinGW
1. Download
. Boost
http://www.boost.org/users/download
Or use TortoiseSVN: svn co http://svn.boost.org/svn/boost/trunk C:\prj\boost
. Python
http://www.python.org/ftp/python
. Graphviz
http://www.graphviz.org/Download_windows.php
. ICU (optional)
http://site.icu-project.org/download
Get icu4c-*-src.tgz/zip, or svn co http://source.icu-project.org/repos/icu/icu/trunk C:\prj\icu
2. Prepare
. Install Python to C:\Python, and add the directory to PATH.
. Set PYTHONPATH=C:\Python\Lib;C:\Python\Lib\site-packages
. Install Graphviz.
. Patch ICU source.
C:\prj\icu\source\config\mh_mingw:
-IMPORT_LIB_EXT = .lib
+IMPORT_LIB_EXT = .a
-DATA_STUBNAME = dt
+DATA_STUBNAME = data
-I18N_STUBNAME = in
+I18N_STUBNAME = i18n
. Compile and install ICU in a MinGW/MSYS shell.
cd /c
cd prj/icu/source
LANG=en_US
./configure --disable-renaming && make clean && make && make check && make install
3. Build and Install
C:
set LANG=en_US
set PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\local\bin;C:\Python;%PATH%
set PYTHONPATH=C:\Python\Lib;C:\Python\Lib\site-packages
cd \prj\boost
bootstrap.bat mingw
bjam --show-libraries
mkdir \boost-build
bjam --debug-configuration --prefix=\boost --build-dir=\boost-build --layout=tagged -d+2 -j2 -sICU_PATH=C:\MinGW\msys\1.0\local toolset=gcc variant=debug,release optimization=space link=shared runtime-link=shared threading=multi address-model=32 install 2>&1 > \boost-build\build.log
. 不要安装到名字中有空格或汉字的目录,有些软件对它们支持不好,会导致问题。
4. Matters Need Attention
In order to use the compiled modules, you should define BOOST_ALL_DYN_LINK and BOOST_AUTO_LINK_TAGGED in boost\config\user.hpp, to be compatible with the above bjam command. Or you can define BOOST_LIB_DIAGNOSTIC to diagnose if you have a linker error like this:
> fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_48.lib'
5. Reference
http://userguide.icu-project.org/design#TOC-ICU-Binary-Compatibility:-Using-ICU
http://www.boost.org/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary
http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html
Last revised: Oct. 27, 2011
1. Download
. Boost
http://www.boost.org/users/download
Or use TortoiseSVN: svn co http://svn.boost.org/svn/boost/trunk C:\prj\boost
. Python
http://www.python.org/ftp/python
. Graphviz
http://www.graphviz.org/Download_windows.php
. ICU (optional)
http://site.icu-project.org/download
Get icu4c-*-src.tgz/zip, or svn co http://source.icu-project.org/repos/icu/icu/trunk C:\prj\icu
2. Prepare
. Install Python to C:\Python, and add the directory to PATH.
. Set PYTHONPATH=C:\Python\Lib;C:\Python\Lib\site-packages
. Install Graphviz.
. Patch ICU source.
C:\prj\icu\source\config\mh_mingw:
-IMPORT_LIB_EXT = .lib
+IMPORT_LIB_EXT = .a
-DATA_STUBNAME = dt
+DATA_STUBNAME = data
-I18N_STUBNAME = in
+I18N_STUBNAME = i18n
. Compile and install ICU in a MinGW/MSYS shell.
cd /c
cd prj/icu/source
LANG=en_US
./configure --disable-renaming && make clean && make && make check && make install
3. Build and Install
C:
set LANG=en_US
set PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\local\bin;C:\Python;%PATH%
set PYTHONPATH=C:\Python\Lib;C:\Python\Lib\site-packages
cd \prj\boost
bootstrap.bat mingw
bjam --show-libraries
mkdir \boost-build
bjam --debug-configuration --prefix=\boost --build-dir=\boost-build --layout=tagged -d+2 -j2 -sICU_PATH=C:\MinGW\msys\1.0\local toolset=gcc variant=debug,release optimization=space link=shared runtime-link=shared threading=multi address-model=32 install 2>&1 > \boost-build\build.log
. 不要安装到名字中有空格或汉字的目录,有些软件对它们支持不好,会导致问题。
4. Matters Need Attention
In order to use the compiled modules, you should define BOOST_ALL_DYN_LINK and BOOST_AUTO_LINK_TAGGED in boost\config\user.hpp, to be compatible with the above bjam command. Or you can define BOOST_LIB_DIAGNOSTIC to diagnose if you have a linker error like this:
> fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_48.lib'
5. Reference
http://userguide.icu-project.org/design#TOC-ICU-Binary-Compatibility:-Using-ICU
http://www.boost.org/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary
http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html
Last revised: Oct. 27, 2011