[PyKDE] Help needed with SIP

Jon jjhome at fire-bug.co.uk
Sat Aug 18 14:46:26 BST 2001


Hello

I have the same problem that Joerg JKaercher reported 8 Jun 2001, unfortunatly his email conversation with Phil did not seem to come to any conclusion. So Im stuck.

I compile my extension (source below) with no error, then get the following error when importing:

Traceback (most recent call last):
  File "MMM.py", line 6, in ?
    import libMMMc
ImportError: /usr/lib/python2.1/site-packages/libMMMcmodule.so: undefined symbol: __ti3CCC
[john at localhost sip]$ python MMM.py
Traceback (most recent call last):
  File "MMM.py", line 6, in ?
    import libMMMc
ImportError: /usr/lib/python2.1/site-packages/libMMMcmodule.so: undefined symbol: __ti3CCC

My system is:
Dell Inspiron 8000
Mandrake 8.0
KDE 2.1.1
QT 2.3.0
KDEDIR = /usr
QTDIR = /usr/lib/qt2
libtool 1.4

********** CCC.h **********

#include <qpushbutton.h>
#include <qstring.h>

class CCC : public QPushButton {
    Q_OBJECT

public:
    CCC(QWidget* parent=0, const char* name=0);
    ~CCC();

public slots:
    void setNumber(const QString&);

private slots:
    void onButtonClicked();

private:
    float number;

signals:
    void result(const QString&);
};

********** CCC.cpp **********

#include "CCC.h"

CCC::CCC(QWidget* parent, const char* name) : QPushButton("&Cube", parent, name)
{
    number = 0.;
    //connect(this, SIGNAL(clicked()), SLOT(onButtonClicked()));
}

CCC::~CCC()
{
}

void CCC::setNumber(const QString& n)
{
    bool ok;
    float newNumber = n.toFloat(&ok);
    if (ok)
    {
        number = newNumber;
    }
}

void CCC::onButtonClicked()
{
    QString res;
    res.sprintf("%f", number*number*number);
    emit result(res);
}

********** MMM.sip **********

// ---------------------------------------------------------------
// This is the SIP interface definition for the MMM module.
// Based on qtgl.sip
// ---------------------------------------------------------------

%Module MMM

%Import qt.sip

%Include CCC.sip

%VersionCode
#include <qglobal.h>
%End

%Makefile Makefile.am .o
# Makefile for building MMM with autoconf/automake/libtool.


MMM_SOURCES = \
	$S \
	MMM.py

SIP_FILES = \
	CCC.sip \
	MMM.sip

noinst_PROGRAMS = sip_helper
sip_helper_SOURCES = sip_helper$c
sip_helper_LDADD = $$(SIP_LDLIBDIRS) -lqt -lXext $$(SIP_LDXFLAGS)

# ---------------------------------------------------------------
# rebuild-src (dummy file) depends on sipjjProxyjj.h so that sip will be called
# ---------------------------------------------------------------
sipMMMProxyMMM.h: rebuild-src

# ---------------------------------------------------------------
# sip outputs c++ files from 'SIP interface definition' files
# ---------------------------------------------------------------
rebuild-src: $$(SIP_FILES)
	sip -I ../sip -I $$(SIP_SIPINSTALLDIR) -c . ../sip/MMM.sip
	touch rebuild-src

sipMMMDeclMMM.h: sipMMMVersion.h

sipMMMVersion.h: sip_helper
	./sip_helper >sipMMMVersion.h

# ---------------------------------------------------------------
# MOC stuff
# sipMMMProxyMMM.moc is included by MMMcmodule.cpp (thats how it gets compiled)
# ---------------------------------------------------------------

MMMcmodule.cpp: sipMMMProxyMMM.moc

sipMMMProxyMMM.moc: sipMMMProxyMMM.h sipMMMVersion.h
	$$(CXXCPP) $$(SIP_CPPFLAGS) sipMMMProxyMMM.h >moc_sipMMMProxyMMM.h
	$$(SIP_MOC) -o sipMMMProxyMMM.moc moc_sipMMMProxyMMM.h

CLEANFILES = \
	MMM.pyc sip_helper sipMMMVersion.h sipMMMProxyMMM.moc \
	moc_sipMMMProxyMMM.h sip* Makefile* MMM.py MMMcmodule* rebuild-src

AM_CPPFLAGS = $$(SIP_CPPFLAGS)
AM_CXXFLAGS = $$(SIP_CXXFLAGS)

libdir = $$(SIP_PYTHONDLMODULES)

datadir = $$(SIP_PYTHONMODULES)
data_DATA = MMM.py

lib_LTLIBRARIES = lib$mcmodule.la
lib$mcmodule_la_SOURCES = $$(MMM_SOURCES)
lib$mcmodule_la_LDFLAGS = -release 2.5
lib$mcmodule_la_LIBADD = -L/usr/lib/qt2/lib -L$$(DESTDIR)$$(libdir) -lqtcmodule $$(SIP_LDLIBDIRS) -lsip -lqt $$(SIP_LDXFLAGS)

install-data-hook:
	(cd /tmp; PYTHONPATH=$$(DESTDIR)$$(datadir):$$(DESTDIR)$$(libdir) $$(PYTHONINTERP) -O -c "import MMM")
%End

********** CCC.sip **********

class CCC : QPushButton
{
%HeaderCode
#include "CCC.h"
%End

public:
    CCC(QWidget * /TransferThis/ = 0, const char * = 0);

public slots:
    void setNumber(const QString&);

signals:
    void result(const QString&);
};

********** Build output **********

creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for a BSD compatible install... /usr/bin/install -c
checking for c++... c++
checking whether the C++ compiler (c++  ) works... yes
checking whether the C++ compiler (c++  ) is a cross-compiler... no
checking whether we are using GNU C++... yes
checking whether c++ accepts -g... yes
checking how to run the C++ preprocessor... c++ -E
checking for Cygwin environment... no
checking for mingw32 environment... no
checking how to run the C preprocessor... cc -E
checking host system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependant libraries... pass_all
checking for object suffix... o
checking for executable suffix... no
checking command to parse /usr/bin/nm -B output... ok
checking for dlfcn.h... yes
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo...
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking for -fno-exceptions... yes
checking for python... /usr/bin/python
checking Python version... 2.1
checking for Python.h... /usr/include/python2.1
checking for lib-dynload... /usr/lib/python2.1
checking for sip.h... /usr/include/sip
checking for -lsip... /usr/lib
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for moc... /usr/lib/qt2/bin/moc
checking for qobject.h... /usr/lib/qt2/include
checking for -lqt... /usr/lib/qt2/lib
checking for dnet_ntoa in -ldnet... no
checking for dnet_ntoa in -ldnet_stub... no
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for Qt version >= 230 and < 300... yes
checking for Qt version >= 220... yes
checking for Qt version >= 220... yes
checking for OpenGL support in Qt... no - qtgl module will not be built
updating cache ./config.cache
creating ./config.status
creating Makefile
creating sip/Makefile
creating config.h
config.h is unchanged
<<<<<<    make   >>>>>>
cd . && autoheader
make  all-recursive
make[1]: Entering directory `/home/john/projectspy/filecopy'
Making all in sip
make[2]: Entering directory `/home/john/projectspy/filecopy/sip'
sip -I ../sip -I /usr/share/sip/qt -c . ../sip/MMM.sip
touch rebuild-src
c++ -DHAVE_CONFIG_H -I. -I. -I..  -I/usr/include/python2.1 -I/usr/include/sip -I/usr/lib/qt2/include  -I/usr/X11R6/include  -fno-exceptions -O2 -c sip_helper.cpp
/bin/sh ../libtool --mode=link c++ -fno-exceptions -O2  -o sip_helper  sip_helper.o -L/usr/lib/qt2/lib -lqt -lXext -L/usr/X11R6/lib  -lSM -lICE -lX11
mkdir .libs
c++ -fno-exceptions -O2 -o sip_helper sip_helper.o  -L/usr/lib/qt2/lib -lqt -lXext -L/usr/X11R6/lib -lSM -lICE -lX11
./sip_helper >sipMMMVersion.h
c++ -E -I/usr/include/python2.1 -I/usr/include/sip -I/usr/lib/qt2/include  -I/usr/X11R6/include sipMMMProxyMMM.h >moc_sipMMMProxyMMM.h
/usr/lib/qt2/bin/moc -o sipMMMProxyMMM.moc moc_sipMMMProxyMMM.h
/bin/sh ../libtool --mode=compile c++ -DHAVE_CONFIG_H -I. -I. -I..  -I/usr/include/python2.1 -I/usr/include/sip -I/usr/lib/qt2/include  -I/usr/X11R6/include  -fno-exceptions -O2 -c MMMcmodule.cpp
c++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/python2.1 -I/usr/include/sip -I/usr/lib/qt2/include -I/usr/X11R6/include -fno-exceptions -O2 -Wp,-MD,.deps/MMMcmodule.pp -c MMMcmodule.cpp  -fPIC -DPIC -o MMMcmodule.lo
/bin/sh ../libtool --mode=compile c++ -DHAVE_CONFIG_H -I. -I. -I..  -I/usr/include/python2.1 -I/usr/include/sip -I/usr/lib/qt2/include  -I/usr/X11R6/include  -fno-exceptions -O2 -c sipMMMCCC.cpp
c++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/python2.1 -I/usr/include/sip -I/usr/lib/qt2/include -I/usr/X11R6/include -fno-exceptions -O2 -Wp,-MD,.deps/sipMMMCCC.pp -c sipMMMCCC.cpp  -fPIC -DPIC -o sipMMMCCC.lo
/bin/sh ../libtool --mode=link c++ -fno-exceptions -O2  -o libMMMcmodule.la -rpath /usr/lib/python2.1/site-packages -release 2.5 MMMcmodule.lo sipMMMCCC.lo -L/usr/lib/qt2/lib -L/usr/lib/python2.1/site-packages -lqtcmodule -L/usr/lib/qt2/lib -lsip -lqt -L/usr/X11R6/lib  -lSM -lICE -lX11  
rm -fr .libs/libMMMcmodule.la .libs/libMMMcmodule.* .libs/libMMMcmodule-2.5.*
(cd . && ln -s MMMcmodule.lo MMMcmodule.o)
(cd . && ln -s sipMMMCCC.lo sipMMMCCC.o)
gcc -shared  MMMcmodule.lo sipMMMCCC.lo  -Wl,--rpath -Wl,/usr/lib/python2.1/site-packages -Wl,--rpath -Wl,/usr/lib/python2.1/site-packages  -L/usr/X11R6/lib -L/usr/lib -L/usr/lib/qt2/lib -L/usr/lib/python2.1/site-packages /usr/lib/python2.1/site-packages/libqtcmodule.so /usr/lib/libsip.so -lqt -lSM -lICE -lX11  -Wl,-soname -Wl,libMMMcmodule-2.5.so -o .libs/libMMMcmodule-2.5.so
(cd .libs && rm -f libMMMcmodule.so && ln -s libMMMcmodule-2.5.so libMMMcmodule.so)
creating libMMMcmodule.la
(cd .libs && rm -f libMMMcmodule.la && ln -s ../libMMMcmodule.la libMMMcmodule.la)
make[2]: Leaving directory `/home/john/projectspy/filecopy/sip'
make[2]: Entering directory `/home/john/projectspy/filecopy'
make[2]: Leaving directory `/home/john/projectspy/filecopy'
make[1]: Leaving directory `/home/john/projectspy/filecopy'




More information about the PyQt mailing list