Question

I am definitely not a bjam expert, so pardon my ignorance if it's something really stupid.

I am trying to build a debug version of boost::python using this tutorial.

I have built Python 3.3.0 in my folder C:\Development\Python-3.3.0. The build is valid, the .lib, .dll and .exe are all present in the PCBuild folder. I tested the interpreter and it works properly.

I am using the following command line:

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

My issue comes from user-config.jam. I tried following the specifications of the tutorial, using the following:

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 ;

But the linking fails... for some reason, it doesn't seem to pick up that I want it to use 3.3, here's a part of the output log:

...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
"

I tried making modifications to the user-config.jam. At first, I didn't escape the \, and surprisingly, it was detecting that I wanted to build 3.3 but the /LIBPATH was wrong (no backslashes):

...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"

As you can see, it's looking for python33_d.lib, which is what is desired, but /LIBPATH doesn't contain the \. I also tried replacing with / which again goes back to trying to link python26_d.lib.

If it can be useful, I uninstalled any previously installed version of Python.

How can I make my jam file properly require the version 3.3 and provide the right paths?

Edit: Playing a bit more around, I removed the "space" before the ;... just doing that makes it look for the right version 3.3, but it's trying to link the release version from a relative libs folder... worst case I wouldn't mind copying the libs from PCBuild to libs

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;

The funny part is that it's the closest to what I'm trying to achieve, but it outputs

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

The jam parser seems pretty weak... any hints or tip would be helpful

Edit 2: trying to simplify the problem, I changed my user-config.jam to contain nothing but:

using python : 3.3 ;

And use the following command line:

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

As expected, it can't find the .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"

So I decided to clone my PCBuild folder into libs so that all the libs I built would be accessible... but after doing so, without changing the .jam or the command line... it's now looking for 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"

The more I dig in, the more confused I am... also, one fails with a LNK1104 and the other one with LNK1181...

Était-ce utile?

La solution

Alright, I ended up deciding to strip all the possible parameters from bjam and build from the start. I finally got bjam to build every target possible using this command line:

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

Where user-config.jam only contains the following:

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 : ;

It seems to be working properly now.

Thanks

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top