Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you build the x64 Boost libraries on Windows?

I've built the x86 Boost libraries many times, but I can't seem to build x64 libraries. I start the "Visual Studio 2005 x64 Cross Tools Command Prompt" and run my usual build:

bjam --toolset=msvc --build-type=complete --build-dir=c:\build install

But it still produces x86 .lib files (I verified this with dumpbin /headers). What am I doing wrong?

like image 692
Ferruccio Avatar asked Nov 19 '08 15:11

Ferruccio


People also ask

How do I build a Boost library in Windows?

Right-click example in the Solution Explorer pane and select Properties from the resulting pop-up menu. In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:\Program Files\boost\boost_1_62_0\lib\. From the Build menu, select Build Solution.

How do I install Boost library?

Go to the directory tools/build/. Run bootstrap.sh. Run b2 install --prefix=PREFIX where PREFIX is the directory where you want Boost. Build to be installed.

Where are Boost libraries installed Windows?

The installers supplied by BoostPro Computing will download and install pre-compiled binaries into the lib\ subdirectory of the boost root, typically C:\Program Files\boost\boost_1_49_0\lib\. If you installed all variants of the Boost.


4 Answers

You need to add the address-model=64 parameter.

Look e.g. here.

like image 170
macbirdie Avatar answered Oct 05 '22 10:10

macbirdie


The accepted answer is correct. Adding this in case somebody else googles this answer and still fails to produce x64 version.

Following is what I had to do to build Boost 1.63 on Visual Studio 15 2017 Community Edition.

Commands executed from VS environment cmd shell. Tools -> Visual Studio Command Prompt

C:\Work\Boost_1_63> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat amd64
C:\Work\Boost_1_63> bootstrap.bat
C:\Work\Boost_1_63> bjam -j4 architecture=x86 address-model=64 link=static stage
C:\Work\Boost_1_63> bjam --prefix=C:\opt\boost architecture=x86 address-model=64 link=static install

You can verify that the resulting .lib is x64 with dumpbin:

C:\Work> dumpbin /headers C:\work\boost_1_63\stage\lib\libboost_locale-vc140-mt-1_63.lib | findstr machine
8664 machine (x64)
8664 machine (x64)
8664 machine (x64)
8664 machine (x64) 
...
like image 31
Teemu Ikonen Avatar answered Oct 05 '22 11:10

Teemu Ikonen


With b2 the command is:

b2 --build-dir=build/x64 address-model=64 threading=multi --build-type=complete --stagedir=./stage/x64

It will show default address-model: 32-bit at the beginning but will still build in 64-bit (how confusing).You should have the dlls created with names such as library-vc140-mt-x64-1_71.dll confirming it is 64-bit.

source: Building Boost 32-bit and 64-bit libraries on Windows

like image 45
RemiDav Avatar answered Oct 05 '22 09:10

RemiDav


You may find following Boost.Build property:

address-model=64
like image 1
sergtk Avatar answered Oct 05 '22 09:10

sergtk