Opened 15 years ago

Closed 12 years ago

#986 closed Bugs (fixed)

Problem building Python modules on boost 1.34.0

Reported by: CarlosEDP Owned by: René Rivera
Milestone: Boost 1.36.0 Component: python USE GITHUB
Version: Boost 1.34.0 Severity: Showstopper
Keywords: Cc: david_abrahams, Thomas Witt

Description

When trying to build a Python module from the Tutorial quickstart from libs\python\example\quickstart , I ran "bjam --toolset=gcc release" using mingw under WindowsXP. The following error happens:

C:\Carlos\Apps\boost_1_34_0\libs\python\example\quickstart>bjam --toolset=gcc release Jamroot:17: in modules.load rule python-extension unknown in module Jamfile</C:/Carlos/Apps/boost_1_34_0/lib s/python/example/quickstart>. C:/Carlos/Apps/boost_1_34_0/tools/build/v2/build\project.jam:312: in load-jamfil e C:/Carlos/Apps/boost_1_34_0/tools/build/v2/build\project.jam:68: in load C:/Carlos/Apps/boost_1_34_0/tools/build/v2/build\project.jam:170: in project.fin d C:/Carlos/Apps/boost_1_34_0/tools/build/v2\build-system.jam:237: in load C:\Carlos\Apps\boost_1_34_0\libs\python\example\quickstart\..\..\..\..\tools\bui ld\v2/kernel\modules.jam:261: in import C:\Carlos\Apps\boost_1_34_0\libs\python\example\quickstart\..\..\..\..\tools\bui ld\v2/kernel/bootstrap.jam:132: in boost-build C:\Carlos\Apps\boost_1_34_0\libs\python\example\quickstart\boost-build.jam:7: in

module scope

The problem is in: rule python-extension unknown in module Jamfile.

After talking to some people on #boost, I changed the file:

tools/build/v2/user-config.jam

and added: using python ;

After this, the module compiles correctly.

Attachments (1)

Jamroot.patch (717 bytes ) - added by René Rivera 15 years ago.
Add "import python ;" to quickstart/Jamroot

Download all attachments as: .zip

Change History (13)

comment:1 by René Rivera, 15 years ago

Info from #1005 duplicate:

When trying to compile Boost Python examples I received the following errors on a Mac using toolset=darwin and on a PC using toolset=msvc-8_0.

rule python-extension unknown in module Jamfile</Users/arthurcoleman/Boost/boost_1_34_0/libs/python/example>. /Users/arthurcoleman/Boost/boost_1_34_0/tools/build/v2/build/project.jam:312: in load-jamfile /Users/arthurcoleman/Boost/boost_1_34_0/tools/build/v2/build/project.jam:68: in load /Users/arthurcoleman/Boost/boost_1_34_0/tools/build/v2/build/project.jam:170: in project.find /Users/arthurcoleman/Boost/boost_1_34_0/tools/build/v2/build-system.jam:237: in load /Users/arthurcoleman/Boost/boost_1_34_0/libs/python/example/../../../tools/build/v2/kernel/modules.jam:261: in import /Users/arthurcoleman/Boost/boost_1_34_0/libs/python/example/../../../tools/build/v2/kernel/bootstrap.jam:132: in boost-build /Users/arthurcoleman/Boost/boost_1_34_0/libs/python/example/boost-build.jam:7: in module scope

After adding import python ; per a suggestion from Dave Abrahams I was successfully able to compile all the examples on my Mac. I will test on Tuesday to confirm that it also fixes the problems I had on a PC. I am submitting this ticket per a request from Dave.

Arhtur

by René Rivera, 15 years ago

Attachment: Jamroot.patch added

Add "import python ;" to quickstart/Jamroot

comment:2 by René Rivera, 15 years ago

The attached patch "fixes" the Boost.Build errors. But it still doesn't work in my case. Without a user-config.jam, and mscv-8.0, and gcc-3.4.5(mingw) I get (in that order):

$ bjam --toolset=msvc
...patience...
...found 1153 targets...
...updating 7 targets...
msvc.link.dll bin\msvc-8.0\debug\threading-multi\extending.pyd bin\msvc-8.0\debug\threading-multi\extending.lib
LINK : fatal error LNK1104: cannot open file 'boost_python-vc80-mt-gd-1_34.lib'

        call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin\msvc-8.0\debug\threading-multi\extending.pyd" /IMPLIB:"bin\msvc-8.0\debug\threading-multi\extending.lib" /LIBPATH:"c:\Python24\libs"   @"bin\msvc-8.0\debug\threading-multi\extending.pyd.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
        if exist "bin\msvc-8.0\debug\threading-multi\extending.pyd.manifest" (
            mt -nologo -manifest "bin\msvc-8.0\debug\threading-multi\extending.pyd.manifest" "-outputresource:bin\msvc-8.0\debug\threading-multi\extending.pyd;2"
        )
    
...failed msvc.link.dll bin\msvc-8.0\debug\threading-multi\extending.pyd bin\msvc-8.0\debug\threading-multi\extending.lib...
msvc.link bin\msvc-8.0\debug\threading-multi\embedding.exe
LINK : fatal error LNK1104: cannot open file 'boost_python-vc80-mt-gd-1_34.lib'

        call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DEBUG /subsystem:console /out:"bin\msvc-8.0\debug\threading-multi\embedding.exe" /LIBPATH:"c:\Python24\libs"  @"bin\msvc-8.0\debug\threading-multi\embedding.exe.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
        if exist "bin\msvc-8.0\debug\threading-multi\embedding.exe.manifest" (
            mt -nologo -manifest "bin\msvc-8.0\debug\threading-multi\embedding.exe.manifest" "-outputresource:bin\msvc-8.0\debug\threading-multi\embedding.exe;1"
        )
    
...failed msvc.link bin\msvc-8.0\debug\threading-multi\embedding.exe...
...skipped <pbin\test_ext.test\msvc-8.0\debug\threading-multi>test_ext for lack of <pbin\msvc-8.0\debug\threading-multi>extending.pyd...
...skipped <pbin\test_embed.test\msvc-8.0\debug\threading-multi>test_embed.run for lack of <pbin\msvc-8.0\debug\threading-multi>embedding.exe...
...failed updating 3 targets...
...skipped 4 targets...
$ bjam --toolset=gcc 
gcc.link.dll ..\..\..\..\bin.v2\libs\python\build\gcc-mingw-3.4.5\debug\boost_python-mgw34-d-1_34_1.a ..\..\..\..\bin.v2\libs\python\build\gcc-mingw-3.4.5\debug\boost_python-mgw34-d-1_34_1.dll
Creating library file: ..\..\..\..\bin.v2\libs\python\build\gcc-mingw-3.4.5\debug\boost_python-mgw34-d-1_34_1.a
..\..\..\..\bin.v2\libs\python\build\gcc-mingw-3.4.5\debug\numeric.o: In function `ZN5boost6python7numeric68_GLOBAL__N_.._.._.._.._libs_python_src_numeric.cpp_62998629_0651A16318throw_load_failureEv':c:/DevRoots/Boost/boost_1_34/libs/python/example/quickstart/../../../../libs/python/src/numeric.cpp:28: undefined reference to `_imp__PyExc_ImportError'
..\..\..\..\bin.v2\libs\python\build\gcc-mingw-3.4.5\debug\numeric.o: In function `ZN5boost6python7numeric68_GLOBAL__N_.._.._.._.._libs_python_src_numeric.cpp_62998629_0651A1634loadEb':c:/DevRoots/Boost/boost_1_34/libs/python/example/quickstart/../../../../libs/python/src/numeric.cpp:56: undefined reference to `_imp__PyType_Type'
[[[--- And many more of the same flavor ---]]]

And the behavior doesn't change if I enable my user-config.jam.

comment:3 by René Rivera, 15 years ago

Cc: Thomas Witt added
Resolution: fixed
Status: newclosed

comment:4 by anonymous, 15 years ago

Resolution: fixed
Status: closedreopened

I also get:

msvc.link.dll bin\msvc-8.0\debug\threading-multi\extending.pyd bin\msvc-8.0\debug\threading-multi\extending.lib LINK : fatal error LNK1104: cannot open file 'boost_python-vc80-mt-gd-1_34.lib'

even after applying the change to version.hpp, but in that case it complains about not being to open file boost_python-vc80-mt-gd-1_34_1.lib

in reply to:  4 comment:5 by René Rivera, 15 years ago

Resolution: fixed
Status: reopenedclosed

Replying to anonymous:

I also get:

msvc.link.dll bin\msvc-8.0\debug\threading-multi\extending.pyd bin\msvc-8.0\debug\threading-multi\extending.lib LINK : fatal error LNK1104: cannot open file 'boost_python-vc80-mt-gd-1_34.lib'

even after applying the change to version.hpp, but in that case it complains about not being to open file boost_python-vc80-mt-gd-1_34_1.lib

It would help if you log in when poking Trac, since I'm going to assume you did something incorrect. The version.hpp bug fix is *only* for the CVS RC_1_34_0 version, it has nothing to do with the released 1.34.0 version. So the version.hpp fix would break the 1.34.0 archive if you apply it.

comment:6 by Sung-Jin Hong <serialx.net@…>, 15 years ago

Resolution: fixed
Status: closedreopened

This bug is still open, I have these bugs too.

I have solved it by copying boost_python-vc80-mt-gd-1_34_1.lib to the c:\python25\libs directory (since jam calls LINKer with that path included as lib path)

It is certainly a problem and it should be fixed.

comment:7 by Sung-Jin Hong <serialx.net@…>, 15 years ago

Here's one of the errors. I've also added 'using python ;' statement to the user-config.jam, otherwise it won't even compile.

Using MSVC 8, Windows XP (Korean), Boost 1.34.1

msvc.link.dll bin\msvc-8.0\debug\std_pair_ext.pyd bin\msvc-8.0\debug\std_pair_ex
t.lib
LINK : fatal error LNK1104: 'boost_python-vc80-mt-gd-1_34_1.lib' Cannot open file.

        call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >
nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin\msvc-8.0\d
ebug\std_pair_ext.pyd" /IMPLIB:"bin\msvc-8.0\debug\std_pair_ext.lib" /LIBPATH:"C
:\Python25\libs"   @"bin\msvc-8.0\debug\std_pair_ext.pyd.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
        if exist "bin\msvc-8.0\debug\std_pair_ext.pyd.manifest" (
            mt -nologo -manifest "bin\msvc-8.0\debug\std_pair_ext.pyd.manifest"
"-outputresource:bin\msvc-8.0\debug\std_pair_ext.pyd;2"
        )

...failed msvc.link.dll bin\msvc-8.0\debug\std_pair_ext.pyd bin\msvc-8.0\debug\s
td_pair_ext.lib...

in reply to:  7 comment:8 by René Rivera, 15 years ago

Replying to Sung-Jin Hong <serialx.net@gmail.com>:

Here's one of the errors. I've also added 'using python ;' statement to the user-config.jam, otherwise it won't even compile.

Using MSVC 8, Windows XP (Korean), Boost 1.34.1

msvc.link.dll bin\msvc-8.0\debug\std_pair_ext.pyd bin\msvc-8.0\debug\std_pair_ex
t.lib

Sung-Jin,

What commands did you run that you are having problems with?

comment:9 by Dave Abrahams, 15 years ago

Owner: set to René Rivera
Status: reopenednew

in reply to:  7 comment:10 by weck <trueweck@…>, 15 years ago

I encounter such a problem too, by add 'using msvc : 8.0 ;' into user-config.jam, the problem can be resolved. Replying to Sung-Jin Hong <serialx.net@gmail.com>:

Here's one of the errors. I've also added 'using python ;' statement to the user-config.jam, otherwise it won't even compile.

Using MSVC 8, Windows XP (Korean), Boost 1.34.1

msvc.link.dll bin\msvc-8.0\debug\std_pair_ext.pyd bin\msvc-8.0\debug\std_pair_ex
t.lib
LINK : fatal error LNK1104: 'boost_python-vc80-mt-gd-1_34_1.lib' Cannot open file.

        call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >
nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin\msvc-8.0\d
ebug\std_pair_ext.pyd" /IMPLIB:"bin\msvc-8.0\debug\std_pair_ext.lib" /LIBPATH:"C
:\Python25\libs"   @"bin\msvc-8.0\debug\std_pair_ext.pyd.rsp"
        if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
        if exist "bin\msvc-8.0\debug\std_pair_ext.pyd.manifest" (
            mt -nologo -manifest "bin\msvc-8.0\debug\std_pair_ext.pyd.manifest"
"-outputresource:bin\msvc-8.0\debug\std_pair_ext.pyd;2"
        )

...failed msvc.link.dll bin\msvc-8.0\debug\std_pair_ext.pyd bin\msvc-8.0\debug\s
td_pair_ext.lib...

comment:11 by John Maddock, 15 years ago

Milestone: Boost 1.34.1Boost 1.35.0

comment:12 by Marshall Clow, 12 years ago

Resolution: fixed
Status: newclosed

It appears Dave added the 'using python ;' to the Jamroot in revision [40714] (back in 2007), but never closed this bug. If anyone is still having this problem, please reopen it.

Note: See TracTickets for help on using tickets.