如何使用 msvc 10.0 为 win8.1 64 位构建 boost python 3.4 共享库

How to build boost python 3.4 shared libraries for win8.1 64 bit with msvc 10.0

我正在尝试为 python 3.4 64 库构建 boost python 因为我需要它们来构建 http://dlib.net/ python 绑定 我的设置如下: 安装 MSVC 12.0 python3.4 64位已安装 我下载了最新的boost 1.57 我能够编译静态库,但是当我尝试 link 动态库时,程序失败了。

我的项目-config.jam 看起来像这样

import option ; 

using msvc : 10.0 ;
using python : 3.4 : C:\Python34 ;

option.set keep-going : false ; 

为了编译 64 位静态库,我的 bjam 看起来像这样

.\bjam.exe --adress-model=64 --with-python variant=release link=static --build-type=complete

这有效找到

当我尝试构建共享库时,我收到此命令的错误:

.\bjam.exe --adress-model=64 --with-python variant=release link=shared --build-type=complete

msvc.link.dll bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python-vc100-mt-1_57.dll
bin.v2\libs\python\build\msvc-10.0\release\threading-multi\numeric.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

        call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /MACHINE:X86 /MANIFEST /subsystem:console /out:"bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python-vc100-mt-1_57.dll" /IMPLIB:"bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python-vc100-mt-1_57.lib" /LIBPATH:"C:\Python34\libs"   @"bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python-vc100-mt-1_57.dll.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%

...failed msvc.link.dll bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python-vc100-mt-1_57.dll bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python-vc100-mt-1_57.lib...
...skipped <pstage\lib>boost_python-vc100-mt-1_57.dll for lack of <pbin.v2\libs\python\build\msvc-10.0\release\threading-multi>boost_python-vc100-mt-1_57.dll...
...skipped <pstage\lib>boost_python-vc100-mt-1_57.lib for lack of <pbin.v2\libs\python\build\msvc-10.0\release\threading-multi>boost_python-vc100-mt-1_57.lib...
msvc.link.dll bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python3-vc100-mt-1_57.dll
bin.v2\libs\python\build\msvc-10.0\release\threading-multi\numeric.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

        call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /MACHINE:X86 /MANIFEST /subsystem:console /out:"bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python3-vc100-mt-1_57.dll" /IMPLIB:"bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python3-vc100-mt-1_57.lib" /LIBPATH:"C:\Python34\libs"   @"bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python3-vc100-mt-1_57.dll.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%

...failed msvc.link.dll bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python3-vc100-mt-1_57.dll bin.v2\libs\python\build\msvc-10.0\release\threading-multi\boost_python3-vc100-mt-1_57.lib...
...skipped <pstage\lib>boost_python3-vc100-mt-1_57.dll for lack of <pbin.v2\libs\python\build\msvc-10.0\release\threading-multi>boost_python3-vc100-mt-1_57.dll...
...skipped <pstage\lib>boost_python3-vc100-mt-1_57.lib for lack of <pbin.v2\libs\python\build\msvc-10.0\release\threading-multi>boost_python3-vc100-mt-1_57.lib...
...failed updating 4 targets...
...skipped 4 targets... </code>

清除 vcvars bat 正在使用 x86 参数调用,我想错误就在这里?

...当然现在我发现了错误 --adress-model 不会出错,它会被忽略 还地址拼了两个"d"浪费了5个小时

如果有人正在寻找如何构建它,对我来说这很有效:

.\bjam.exe --with-python address-model=64 variant=release link=shared --build-type=complete