[PyKDE] Help needed with SIP

Jon jjhome at fire-bug.co.uk
Mon Aug 20 03:44:13 BST 2001


Hello Gerard

Thanks again for all your help.

I carefully went through your email and tried everything you said but no luck.

1. Yes, I generate a new Makefile.am etc. below is the script I use to pick up changes in MMM.sip. I used PyQy and qtgl project files as a starting point for autoconf/automake/configure stuff.

2. Yes I get "gcc -shared CCC.lo MMMcmodule.lo..."   (you said CCCcmodule.lo ?) output shown below.

3. strings CCC.lo did not find __ti3CCC  (NM lists it as U).

4. Dont know about rtti so I tried both ways, -frtti gives the __ti3CCC error.  -fno-rtti gives (all listings below are with -fno-rtti):

Python 2.1.1 (#5, Aug 19 2001, 13:52:21)
[GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import MMM
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "MMM.py", line 6, in ?
    import libMMMc
ImportError: /usr/lib/python2.1/site-packages/libMMMcmodule.so: undefined symbol: metaObject__C3CCC
>>>

5. I Changed back to libtool 1.4

6. I deleted *.la in site-packages and  /usr/lib/libsip*.la

This is driving me mad. I thought if I started with a very simple example, it would be easy !


********** c++filt output **********

[root at localhost filecopy]# c++filt metaObject__C3CCC
CCC::metaObject(void) const

********** NM output **********

root at localhost sip]# nm -A -C CCC.lo
CCC.lo:         U QPushButton::~QPushButton(void)
CCC.lo:00000090 T CCC::~CCC(void)
CCC.lo:         U QString::shared_null
CCC.lo:         U _GLOBAL_OFFSET_TABLE_
CCC.lo:         U QPushButton::QPushButton(QString const &, QWidget *, char const *)
CCC.lo:00000000 T CCC::CCC(QWidget *, char const *)
CCC.lo:         U QString::QString(char const *)
CCC.lo:         U __builtin_delete
CCC.lo:         U CCC virtual table
CCC.lo:         U CCC::QPaintDevice virtual table
CCC.lo:         U QStringData::deleteSelf(void)
CCC.lo:00000000 t gcc2_compiled.
CCC.lo:         U QString::makeSharedNull(void)
CCC.lo:00000130 T CCC::onButtonClicked(void)
CCC.lo:         U CCC::result(QString const &)
CCC.lo:000000f0 T CCC::setNumber(QString const &)
CCC.lo:         U QString::sprintf(char const *,...)
CCC.lo:         U QString::toFloat(bool *) const
[root at localhost sip]#


********** Build script **********

# Force full build
echo "<<<<<<  remove  >>>>>>"
rm -f config.cache
rm -f ./sip/rebuild-src
# Use sip to make Makefile.am
echo "<<<<<< SIP Build Makefile.am >>>>>>"
cd ./sip
sip -I ../sip -I /usr/share/sip/qt -m Makefile.am MMM.sip
cd ..
echo "<<<<<<  aclocal   >>>>>>"
aclocal
echo "<<<<<<  autoconf  >>>>>>"
autoconf
echo "<<<<<<  automake  >>>>>>"
automake
echo "<<<<<< configure >>>>>>"
./configure --with-sip-library=/usr/lib --with-sip-include=/usr/include/sip --with-sip-install=/usr/share/sip/qt --with-qt-dir=/usr/lib/qt2
echo "<<<<<<    make   >>>>>>"
make

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

<<<<<<  remove  >>>>>>
<<<<<< SIP Build Makefile.am >>>>>>
<<<<<<  aclocal   >>>>>>
<<<<<<  autoconf  >>>>>>
<<<<<<  automake  >>>>>>
<<<<<< configure >>>>>>
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'
/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-rtti  -fno-exceptions -O2 -c CCC.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-rtti -fno-exceptions -O2 -Wp,-MD,.deps/CCC.pp -c CCC.cpp  -fPIC -DPIC -o CCC.lo
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-rtti  -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-rtti  -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-rtti -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-rtti  -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-rtti -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 1.0 CCC.lo MMMcmodule.lo sipMMMCCC.lo -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-1.0.*
(cd . && ln -s CCC.lo CCC.o)
(cd . && ln -s MMMcmodule.lo MMMcmodule.o)
(cd . && ln -s sipMMMCCC.lo sipMMMCCC.o)
gcc -shared  CCC.lo MMMcmodule.lo sipMMMCCC.lo  -L/usr/lib/python2.1/site-packages -lqtcmodule -L/usr/lib/qt2/lib -lsip -lqt -L/usr/X11R6/lib -lSM -lICE -lX11  -Wl,-soname -Wl,libMMMcmodule-1.0.so -o .libs/libMMMcmodule-1.0.so
(cd .libs && rm -f libMMMcmodule.so && ln -s libMMMcmodule-1.0.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'
Bye...

********** 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 = \
	CCC.cpp \
	$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) -fno-rtti
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 1.0
lib$mcmodule_la_LIBADD = -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




More information about the PyQt mailing list