120

Is there a version of 64-bit Boost library for VS2008 ? Or do I have to compile one myself? if, so, does anyone have experience with it?

ra170
  • 3,643
  • 7
  • 38
  • 52

5 Answers5

226

As a short answer:

bjam --toolset=msvc-9.0 address-model=64 --build-type=complete

As a longer answer, here are my build notes for having VS .NET 2008 32-bit and 64-bit boost libraries in the same hierarchy (which is I suspect a common use case):

  1. Build the win32 binaries

    bjam --toolset=msvc-9.0 --build-type=complete stage
    
  2. Create the directory lib\win32

  3. Move the contents of stage\lib to lib\win32
  4. Remove the directories bin.v2 and stage
  5. Build the x64 binaries

    bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
    
  6. Create the directory lib\x64

  7. Move the contents of stage\lib to lib\x64
  8. Remove the directories bin.v2 and stage
Adrian Conlon
  • 3,941
  • 1
  • 21
  • 17
  • 25
    You can specify the stage directory as well, which removes the need to copy the resulting libraries around: bjam --toolset=msvc-9.0 address-model=64 --build-type=complete --stagedir=lib\x64 stage – hkaiser Feb 24 '10 at 14:05
  • 1
    @hkaiser When I tried that the libraries ended up in `lib\x64\lib`. – Tim Sylvester Jun 29 '10 at 17:19
  • 16
    Unfortunately to build 64, address-model=64 doesn't work. You need to have your path pointing to Visual Studio \bin\amd64\cl.exe. Otherwise it builds 32 bit version. To do this you can start Microsoft SDK Command prompt and use "setenv /Release /x64" which redefines all the paths. – Budric Dec 13 '11 at 16:59
  • 1
    Thanks @Budric. If using 2010 Express with Windows SDK 7.1, you must start an **SDK** Command Prompt from the start menu. If it does not already report 64-bit, use setenv as you say. Then, re-run bootstrap. Finally, run b2 with address-model=64 in addition to any standard parameters. – kipkennedy Jan 01 '12 at 23:46
  • 2
    @Budric, are you sure? It seems to have worked for me and [this](http://www.boost.org/boost-build2/doc/html/bbv2/reference/tools.html#v2.reference.tools.compiler.msvc.64) explicitly states to provide a path to 32 bit compiler even when building in 64 bit. – Maciej Gryka Jan 03 '12 at 12:39
  • 1
    @Budric: no, VC++ ships with two compilers, a 32-bit and a 64-bit executable. But both can *target* either platform. The 32-bit compiler can generate 64-bit code and vice versa. BUt you can't run the 64-bit compiler on a 32-bit OS – jalf Mar 22 '12 at 21:02
  • 4
    If you need to build both 32 and 64 bit version it is also possible to use the stagedir parametter: "bjam --stagedir=./lib_64bit address-model=64 toolset=msvc threading=multi" and "bjam --stagedir=./lib toolset=msvc threading=multi" – Odin Jul 11 '12 at 15:20
63

I've got the built binaries on my site: http://boost.teeks99.com

Edit 2013-05-13: My builds are now available (starting from 1.53) directly from the sourceforge page.

teeks99
  • 3,585
  • 2
  • 30
  • 38
22

UPDATE(19.09.2017): added script lines for VS2017. Please be aware that Boost supports VS2017 compiler from a certain version up. I used the latest version (1.65.1).

I used this scripts for building boost for x64 and x86 platforms, lib and dll, debug and release for VS2017, VS2015 and VS2013:

md stage\VS2017\x64
md stage\VS2015\x64
md stage\VS2013\x64    

b2 --stagedir=./stage/VS2017/x64 address-model=64 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2017/x64 address-model=64 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=release  

b2 --stagedir=./stage/VS2015/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2015/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release

b2 --stagedir=./stage/VS2013/x64 address-model=64 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2013/x64 address-model=64 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=release


md stage\VS2017\win32
md stage\VS2015\win32
md stage\VS2013\win32

b2 --stagedir=./stage/VS2017/win32 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2017/win32 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=release

b2 --stagedir=./stage/VS2015/win32 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2015/win32 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release

b2 --stagedir=./stage/VS2013/win32 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2013/win32 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=release

pause

You can make a .bat file and run it for building your boost binaries.

mtb
  • 1,350
  • 16
  • 32
12

At this moment, the 64-bits binaries provided by teeks99 (see other answer) appear to be the only free 64-bits binaries around. For a while, BoostPro also provided 64-bits binaries, but as of 1.51 they appear to be out or business.

So, there we're back to two options again: the teeks99 binaries, or building your own.

Most of the information I needed to build my own was here: https://stackoverflow.com/a/2655683/613288

The only thing missing was how to get this to work with the free version of Visual Studio 2010 Express. I found that missing part somewhere else, and after some customization the final recipe I used for my build of the boost 1.49.0 binaries was:

Start Visual C++, and from the Tools menu start Visual Studio Command Prompt.

In the console window, do the following:

"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd"  /Release  /x64

and then in the boost directory:

bootstrap.bat
b2  -a  -sBZIP2_SOURCE="C:\bzip2-1.0.6"   -sZLIB_SOURCE="C:\zlib-1.2.5"   --toolset=msvc-10.0  architecture=x86  address-model=64  link=static  --with-date_time  --with-filesystem  --with-serialization  --with-test  --with-thread  --with-system  --with-regex  --with-iostreams  stage

The last command is customized for what I happened to need (just some statically linked libraries).

Community
  • 1
  • 1
ecotax
  • 1,933
  • 17
  • 22
  • I downloaded their x64 1_51 installer, however, it contains damaged archive for system lib and it appears that some other libs there are x86 (I get linker warnings). After switching to teeks99's libs everything became OK. – Alex Sep 24 '12 at 14:22
4

I made me a small script which compiles them all for VS2005 and VS2008:

md stage\lib\win32
md stage\lib\x64

REM Visual Studio 2005
bjam --toolset=msvc-8.0 --build-type=complete stage
move /Y stage\lib\* stage\lib\win32\

bjam --toolset=msvc-8.0 address-model=64 --build-type=complete stage
move /Y stage\lib\* stage\lib\x64\

REM Visual Studio 2008
bjam --toolset=msvc-9.0 --build-type=complete stage
move /Y stage\lib\* stage\lib\win32\

bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
move /Y stage\lib\* stage\lib\x64\
Jonathan
  • 4,847
  • 3
  • 32
  • 37