[PyKDE] Importing a generated library

Jahn Otto Næsgaard Andersen jotto at jotto.no
Tue Jan 27 12:51:00 GMT 2004


Hi,

I have sip'ed a C++ class and compiled the resulting files with

g++ -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -pipe -fPIC -O2 -Wall -W
-D_REENTRANT -c -I.. -I. -I/usr/local/include/python2.3
-I/home/jotto/work/hololib/src   sipHoloLibcmodule.cpp

g++ -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -pipe -fPIC -O2 -Wall -W
-D_REENTRANT -c -I.. -I. -I/usr/local/include/python2.3
-I/home/jotto/work/hololib/src   sipHoloLibBird.cpp

and then linked everything together with

g++ -shared -Wl,-rpath,/usr/lib/qt-x11-free-3.2.3/lib
-L/usr/local/lib/python2.3/site-packages -L/usr/local/lib/vtk -lvtkCommon
-lvtkRendering -lvtkGraphics -lvtkHybrid -L/usr/lib/qt-x11-free-3.2.3/lib
-lqt-mt -o hololib.so *.o /home/jotto/work/hololib/build/*.o


The .o files in /home/jotto/work/hololib/build are C++ .o files that I
don't need to access directly from python. Note that I am dynamically
linking in qt and VTK.

It compiles and links without errors, but when I copy the hololib.so to
python's site-packages, I get the following error when I try to import:


>>> from hololib import *
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init function (inithololib)


I try to check the defined symbols in hololib.so with nm:

jotto at holodeck(~/work/py_hololib/sipcode)$ nm hololib.so | grep initHol
000172a0 T initHoloLib
0002ad28 d _ZZ11initHoloLibE7methods

It seems to me like initHoloLib is defined.

I'm using RedHat 8.0, Python 2.3, SIP 4.0rc2 and gcc 3.2.

Any ideas?



Btw, thank you for all the help I have got so far! I think I'm close to
the goal now :-)


Jahn Otto




More information about the PyQt mailing list