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

时间:2015-03-06 10:50:09

标签: python windows boost 64-bit

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

我的project-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参数调用的,我假设错误在这里?

1 个答案:

答案 0 :(得分:1)

...当然现在我发现了错误 --adress-model没有给出错误,只是被忽略了 地址拼写为两个&#34; d&#34;浪费了5个小时

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

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