4

我绝对不是bjam专家,所以如果它真的很愚蠢,请原谅我的无知。

我正在尝试构建一个使用本教程debug的版本。boost::python

我已经Python 3.3.0在我的文件夹中建立了C:\Development\Python-3.3.0。构建是有效的.lib.dll.exe都存在于PCBuild文件夹中。我测试了解释器,它工作正常。

我正在使用以下命令行:

bjam --user-config=user-config.jam --with-python python-debugging=on threading=multi variant=debug link=shared stage

我的问题来自user-config.jam. 我尝试遵循本教程的规范,使用以下内容:

using python : 3.3 : C:\\Development\\Python-3.3.0\\PCBuild\\python_d.exe
    : C:\\Development\\Python-3.3.0\\Include C:\\Development\\Python-3.3.0\\PC
    : C:\\Development\\Python-3.3.0\\PCBuild
    : <python-debugging>on ;

但是链接失败......由于某种原因,我希望它使用 3.3 似乎并没有发现,这是输出日志的一部分:

...updating 10 targets...
msvc.link.dll bin.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threa
ding-multi\boost_python-vc110-mt-gyd-1_52.dll
LINK : fatal error LNK1104: cannot open file 'python26_d.lib'

        call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
at" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /subsystem:console /out:"b
in.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threading-multi\boos
t_python-vc110-mt-gyd-1_52.dll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\debu
g\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.lib" /LIBPA
TH:"C:\Development\Python-3.3.0\PCBuild"   @"bin.v2\libs\python\build\msvc-11.0\
debug\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.dll.rsp
"

我尝试对user-config.jam. 起初,我没有逃脱\,令人惊讶的是,它检测到我想构建 3.3 但/LIBPATH错误(没有反斜杠):

...updating 10 targets...
msvc.link.dll bin.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threa
ding-multi\boost_python-vc110-mt-gyd-1_52.dll
LINK : fatal error LNK1181: cannot open input file 'python33_d.lib'

        call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
at" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /subsystem:console /out:"b
in.v2\libs\python\build\msvc-11.0\debug\python-debugging-on\threading-multi\boos
t_python-vc110-mt-gyd-1_52.dll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\debu
g\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.lib" /LIBPA
TH:"C:DevelopmentPython-3.3.0PCBuild"   @"bin.v2\libs\python\build\msvc-11.0\deb
ug\python-debugging-on\threading-multi\boost_python-vc110-mt-gyd-1_52.dll.rsp"

如您所见,它正在寻找python33_d.lib,这是所需的,但/LIBPATH不包含\. 我也尝试用/which 再次返回尝试链接python26_d.lib

如果它有用,我卸载了任何以前安装的 Python 版本。

如何使我的jam文件正确地需要 3.3 版并提供正确的路径?

编辑:玩得更多,我在...之前删除了“空格” ;...只是这样做使它寻找正确的版本3.3,但它试图从相关libs文件夹链接发布版本...最坏的情况我不会不介意将库从复制PCBuildlibs

using python : 3.3 : C:\\Development\\Python-3.3.0\\PCBuild\\python_d.exe
    : C:\\Development\\Python-3.3.0\\Include C:\\Development\\Python-3.3.0\\PC
    : C:\\Development\\Python-3.3.0\\PCBuild
    : <python-debugging>on;

有趣的是,它最接近我想要实现的目标,但它输出

C:\Development\boost_1_52_0\boost_1_52_0\user-config.jam:4: syntax error at EOF

jam解析器似乎很弱......任何提示或提示都会有所帮助

编辑 2:试图简化问题,我将其更改user-config.jam为仅包含以下内容:

using python : 3.3 ;

并使用以下命令行:

bjam --user-config=user-config.jam --with-python threading=multi variant=release link=shared stage

正如预期的那样,它找不到.lib

...updating 4 targets...
msvc.link.dll bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_p
ython3-vc110-mt-1_52.dll
LINK : fatal error LNK1181: cannot open input file 'python33.lib'

        call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
at" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /MACHINE:X86 /subsystem:console /out:"bin.v2\l
ibs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.d
ll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_py
thon3-vc110-mt-1_52.lib" /LIBPATH:"C:\Development\Python-3.3.0\libs"   @"bin.v2\
libs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.
dll.rsp"

所以我决定将我的PCBuild文件夹克隆到libs其中,以便可以访问我构建的所有库......但这样做之后,无需更改.jam或命令行......它现在正在寻找 Python 2.6?!?

...updating 4 targets...
msvc.link.dll bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_p
ython3-vc110-mt-1_52.dll
LINK : fatal error LNK1104: cannot open file 'python26.lib'

        call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.b
at" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /MACHINE:X86 /subsystem:console /out:"bin.v2\l
ibs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.d
ll" /IMPLIB:"bin.v2\libs\python\build\msvc-11.0\release\threading-multi\boost_py
thon3-vc110-mt-1_52.lib" /LIBPATH:"C:\Development\Python-3.3.0\libs"   @"bin.v2\
libs\python\build\msvc-11.0\release\threading-multi\boost_python3-vc110-mt-1_52.
dll.rsp"

我越深入,我就越困惑......而且,一个失败了,另一个失败LNK1104LNK1181......

4

1 回答 1

3

好吧,我最终决定bjam从一开始就剥离所有可能的参数并构建。我终于bjam可以使用这个命令行构建每个可能的目标:

 bjam --user-config=user-config.jam --with-python

其中user-config.jam仅包含以下内容:

using python : 3.3 : C:\\Development\\Python-3.3.0\\PCBuild\\python.exe
    : C:\\Development\\Python-3.3.0\\Include C:\\Development\\Python-3.3.0\\PC
    : C:\\Development\\Python-3.3.0\\PCBuild : ;

它现在似乎工作正常。

谢谢

于 2012-12-24T07:04:56.390 回答