代码之家  ›  专栏  ›  技术社区  ›  Ferruccio

如何在Windows上构建x64 Boost库?

  •  47
  • Ferruccio  · 技术社区  · 18 年前

    我已经构建了很多次x86boost库,但似乎无法构建x64库。我启动“Visual Studio 2005 x64跨工具命令提示符”并运行我的常规生成:

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

    但它仍然生成x86.lib文件(我用dumpbin/headers验证了这一点)。 我做错了什么?

    3 回复  |  直到 17 年前
        1
  •  64
  •   macbirdie    18 年前

    您需要添加 address-model=64 参数

    here

        2
  •  10
  •   Teemu Ikonen    7 年前

    以下是我在Visual Studio 15 2017社区版上构建Boost 1.63所做的工作。

    从VS环境命令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是否为带有dumpbin的x64:

    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) 
    ...
    
        3
  •  3
  •   RemiDav    7 年前

    对于b2,命令是:

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

    它将显示 default address-model: 32-bit 开始时,但仍将以64位构建(多么令人困惑) library-vc140-mt-x64-1_71.dll 确认它是64位的。

    资料来源: Building Boost 32-bit and 64-bit libraries on Windows

        4
  •  1
  •   sergtk    7 年前

    你可能会发现 Boost.Build property

    address-model=64