Monday, April 29, 2013

How I build Boost for 64 bit Windows

I decided to build liblas binaries for 64 bit Windows since I could not easily find the 64-bit binaries. One of the prerequisites include boost. However, I had some difficulty getting 64-bit Boost binaries and header files, and the official Boost 64 bit installer seems to have x86 libraries included somehow causing me linking errors while building liblas. So I decided to compile Boost for x64 myself for liblas. The following steps are what I did to get Boost to compile.

  1. Download the latest Boost source code from Sourceforge http://sourceforge.net/projects/boost/files/boost/. Extract the files to a folder e.g. C:\Work\src\boost_1_52_0\.
     
  2. On the Windows desktop, select Start | All Programs | Microsoft Visual Studio 2010 | Visual Studio Tools | Visual Studio x64 Win64 Command Prompt.

    The Visual Studio x64 Win64 Command Prompt appears.
  3. In the Command Prompt, change directory to the extracted Boost source code folder e.g.

    C:\> cd \Work\src\boost_1_52_0
  4. In the Command Prompt, run the bootstrap.bat.

    C:\> bootstrap.bat

    Bootstrapping is done.
  5. In the Command Prompt, run b2.exe.

    C:\> b2 --toolset=msvc-10.0 architecture=x86 address-model=64 stage

    The Boost C++ libraries are built.

3 comments:

Unknown said...

hi ,

thank you for the helpful tutorial

quick question why are u setting the architecture as x86 not x64

thank you for your prompt reply

dominoc925 said...

hi there, that was a long time ago and my memory fades... It was probably to indicate Intel chips since there was no x64 option for that parameter.

Mritula said...

HI Thanks for the code.

we get a page of error like this "...failed compile-c-c++ bin.v2\libs\wave\build\msvc-10.0\debug\address-model-64\architecture-x86\link-static\threading-multi\cpplexer\re2clex\cpp_re.obj...
...skipped libboost_wave-vc100-mt-gd-1_62.lib for lack of instantiate_cpp_exprgrammar.obj...
...skipped libboost_wave-vc100-mt-gd-1_62.lib for lack of libboost_wave-vc100-mt-gd-1_62.lib...
...failed updating 490 targets...
...skipped 300 targets..."

Do we need to go install boost libraries manually?