Boost logo

Boost Users :

From: Marek \ (imbaczek_at_[hidden])
Date: 2006-02-19 16:06:01


Hi,

I have a problem with Boost.Python, mingw and bjam not working together, and
apparently it is jam that is the issue - or rather, it's rules. The root of the
problem seems to be that initmodule function doesn't get exported and I have
absolutely no idea what causes this (and even if I had, I propably wouldn't
know how to fix it, jam is pretty much dark magic for me :))

(Warning, lots of noise follows.)

Manual compilation (which, amazingly, works):

E:\boost_1_33_1\libs\python\example\tutorial>g++ hello.cpp -g -O0 -shared
        -Ic:\boost\include\boost-1_33_1 -Ic:\python24\include
        -Lc:\boost\lib -lpython24 -lboost_python-mgw-d -o hello.pyd

E:\boost_1_33_1\libs\python\example\tutorial>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import hello
>>> hello.greet()
'hello, world'
>>>

E:\boost_1_33_1\libs\python\example\tutorial>pexports hello.pyd
LIBRARY hello.pyd
EXPORTS
inithello

------------------------------------------------------------------------

Compilation using bjam (lines have been wrapped in a text editor):

E:\boost_1_33_1\libs\python\example\tutorial>bjam -sTOOLS=mingw -d+2
gcc-C++-action bin\tutorial\hello.pyd\mingw\debug\hello.obj

    "g++" -c -Wall -ftemplate-depth-255 -DBOOST_PYTHON_DYNAMIC_LIB -g -O0
    -fno-inline -mno-cygwin -I"bin\tutorial" -I "E:\boost_1_33_1" -I
    "c:\Python24\include" -o "bin\tutorial\hello.pyd\mingw\debug\hello.obj"
    "hello.cpp"

gcc-Link-action bin\tutorial\hello.pyd\mingw\debug\hello.pyd
bin\tutorial\hello.pyd\mingw\debug\hello.lib

    "g++" "-Wl,--enable-auto-image-base"
    "-Wl,--exclude-symbols,_bss_end__:_bss _start__:_data_end__:_data_start__"
    "-Wl,--out-implib,bin\tutorial\hello.pyd\min gw\debug\hello.lib" -g -shared
    -Wl,--allow-multiple-definition -mno-cygwin -o
    "bin\tutorial\hello.pyd\mingw\debug\hello.pyd"
    -L"bin/boost/libs/python/build/boost_python.dll/mingw/debug" -L""
    "bin\tutorial\hello.pyd\mingw\debug\hello.obj"
    "c:\Python24\libs\libpython24.a"
    "bin\boost\libs\python\build\boost_python.dll\mingw\debug\boost_python.lib"
    "c:\Python24\libs\libpython24.a"
    "bin\boost\libs\python\build\boost_python.dll\mingw\debug\boost_python.lib"
    -lboost_python

E:\boost_1_33_1\libs\python\example\tutorial\bin\tutorial\hello.pyd\mingw\debug>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import hello
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init function (inithello)
>>>

E:\boost_1_33_1\libs\python\example\tutorial\bin\tutorial\hello.pyd\mingw\debug>pexports
hello.pyd
LIBRARY hello.pyd
EXPORTS

------------------------------------------------------------------------

c:\gcc -v
Reading specs from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry
--disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt
--without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw special)

------------------------------------------------------------------------

Required dlls (boost_python.dll and -mgw-d) have been copied to their relevant
working dirs.

Please note that I'm a Boost newbie and that my first Boost
compilation finished just a few hours ago :) Also, tests from
python/test directory fail in a rather noisy way, and my guess is that
the reason is the same.

--
{ Marek Baczyñski :: UIN 57114871 :: GG 161671 :: JID imbaczek_at_[hidden]  }
{ http://www.vlo.ids.gda.pl/ | imbaczek at poczta fm | http://www.promode.org }
.. .. .. .. ... ... ...... evolve or face extinction ...... ... ... .. .. .. ..

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net