2008-11-19 111 views
44

我已經多次構建了x86 Boost庫,但似乎無法構建x64庫。我啓動「Visual Studio 2005的十字x64的工具命令提示符」,然後運行我平時的積累:如何在Windows上構建x64 Boost庫?

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

但它仍然產生86 .lib文件(我驗證了這一點與DUMPBIN /頭)。 我在做什麼錯?

回答

57

您需要添加address-model=64參數。

看起來例如, here

+2

這個答案也適用於較新的助推構建工具,`b2`。 – anderas 2016-05-25 08:55:31

2

接受的答案是正確的。如果有人使用此答案並且仍然無法生成x64版本,請添加此項。

以下是我在VS 15 2017 Community Edition上構建Boost 1.63所必須做的事情。

從VS環境cmd shell執行的命令。工具 - > Visual Studio命令提示符

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 

您可以驗證所產生的.lib支持x64與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) ...