These are my notes for building Boost with Boost.Python and Boost.Locale support for both Win32 and Win64 using MSVC 2010 Ultimate.
If you just want to use the pre-built libraries with Boost.Python (Python) and localization (ICU) support, but without spending hours compiling them yourself, you can just download them from the pre-built binaries page.
Preparation
The ICU Library (for Boost.Locale)
Download the latest source code of the ICU library.
The prebuilt binaries contain no Debug symbols. If you want to build them yourself, you will need the Source Code:
- icu4c-49_1_2-src.zip [19.2MB]
I use Cygwin/MSVC to build the ICU Library in all variants (debug/release) with static/shared linking. Find my prebuilt ICU Libraries and a how to DIY on my other post here.
Python (for Boost.Python)
Download the latest 2.x release of Python. Currently v2.7.6 is the latest version and can be found at:
You can extract the two files into convenient directories from the command line:
msiexec /a python-2.7.6.msi /qb TARGETDIR=I:\dev\python msiexec /a python-2.7.6.amd64.msi /qb TARGETDIR=I:\dev\python64
Building Boost
Download Boost. I used release v1.49.0.
I now assume that you have the following layout (you should adjust your paths in the commands further below as appropriate):
Bouse Sources in I:\tmp\boost-src ICU (shared 32/64-bit) in I:\dev\icu-shared ICU (static 32/64-bit) in I:\dev\icu-static Python (32-bit) in I:\dev\python Python (64-bit) in I:\dev\python64
I will be building Boost in the intermediate directory I:\tmp\boost-build
, and I will install the resulting Boost libraries in I:\dev\boost
for the 32-bit library, and I:\dev\boost64
for the 64-bit library. I prefer to have two separate boost directories, as this makes it easier to use with CMake. Remember to delete the build-dir (I:\tmp\boost-build) after you are done. It should save around 5GB for each of the 32- and 64-bit builds. Note also that I have a quad core CPU and therefore I will enable it (-j4
) to build Boost faster, change this or remove it to reflect the capabilities of your CPU.
Building 32-bit Boost Libraries
Create a Boost Jam user configuration file: I:\tmp\boost-src\user-config.jam
and add:
using python : 2.7 : I:\\dev\\python\\python.exe : I:\\dev\\python\\include : I:\\dev\\python\\libs : <address-model>32 ;
Open a 32-bit Visual Studio Command Prompt (2010):
%comspec% /k ""D:\dev\msvc2010\VC\vcvarsall.bat"" x86
To build Boost invoke the command:
bootstrap.bat b2 -j4 -sICU_PATH=I:\dev\icu-static link=static ^ --user-config=I:\tmp\boost-src\user-config.jam ^ --prefix=I:\dev\boost ^ --build-dir=I:\tmp\boost-build ^ --toolset=msvc-10.0 ^ --without-mpi ^ --build-type=complete install ^ --debug-configuration
If everything goes well you should see in the building output of boost:
... - has_icu builds : yes ... - icu : yes ...
The above will build Boost static libraries. You can tweak the parameters e.g. -sICU_PATH=I:\dev\icu-shared link=shared
to build Boost shared. These commands will build all libraries, except from Boost.Python. To built, you need to run the command again, with the very same options, expect replace --without-mpi
, with --with-python
, for example:
b2 -j4 -sICU_PATH=I:\dev\icu-static link=static ^ --user-config=I:\tmp\boost-src\user-config.jam ^ --prefix=I:\dev\boost ^ --build-dir=I:\tmp\boost-build ^ --toolset=msvc-10.0 address-model=32 ^ --with-python ^ --build-type=complete install ^ --debug-configuration
Building 64-bit Boost Libraries
Edit the file: I:\tmp\boost-src\user-config64.jam
and add:
using python : 2.7 : I:\\dev\\python64\\python.exe : I:\\dev\\python64\\include : I:\\dev\\python64\\libs : <address-model>64 ;
Open a 64-bit Visual Studio Command Prompt (2010):
%comspec% /k ""D:\dev\msvc2010\VC\vcvarsall.bat"" x64
To build Boost invoke the command:
bootstrap.bat b2 -j4 -sICU_PATH=I:\dev\icu-static link=static ^ --user-config=I:\tmp\boost-src\user-config.jam ^ --prefix=I:\dev\boost64 ^ --build-dir=I:\tmp\boost-build ^ --toolset=msvc-10.0 address-model=64 ^ --without-mpi ^ --build-type=complete install ^ --debug-configuration
Again, if everything goes well you should see in the building output of boost:
... - has_icu builds : yes ... - icu (lib64) : yes ...
Again, the above will build the 64-bit Boost static libraries. You can tweak the parameters e.g. -sICU_PATH=I:\dev\icu-shared link=shared
to build Boost shared. These commands will build all libraries, except from Boost.Python. To built, you need to run the command again, with the very same options, expect replace --without-mpi
, with --with-python
, for example:
b2 -j4 -sICU_PATH=I:\dev\icu-static link=static ^ --user-config=I:\tmp\boost-src\user-config64.jam ^ --prefix=I:\dev\boost64 ^ --build-dir=I:\tmp\boost-build ^ --toolset=msvc-10.0 address-model=64 ^ --with-python ^ --build-type=complete install ^ --debug-configuration
Download the produced binaries from the pre-built binaries page.
Note: I have not extensively tested the libraries and therefore if you are having trouble using them, please feel free to leave a comment.