[PyQt] SIP PyQT compilation issue

emmanuel_mayssat at lynceantech.com emmanuel_mayssat at lynceantech.com
Thu Mar 31 23:24:30 BST 2011

On 09:20 Thu 31 Mar     , Phil Thompson wrote:
> You can lie to SIP as much as you want. For example if B is derived from A
> in C++ you can tell SIP that it doesn't derive from anything and you won't
> get access to any of A's methods from Python. You could even say that B
> contained some of A's methods. The main problem area is virtuals (if you
> want to expose them) which really have to be in the right class (including
> all their reimplementations).

I understand. This means:
1/ I can remove superclass from a class definition
In which case, I can add methods to a class wich are actually in the superclass
2/ I can create custom methods which are not in the original C++ library
But of course the motivation should be to stay as close as possible to the C++ declaration.
(Given that this is core concept, it may be useful to have a test case in the doc!)
So I get it, with SIP we can lie through your teeth.

But as my wife once told me, I am not a very good liair.
And that's confirmed by SIP...

$ grep UserMessage * 
CaFramework.sip://sip %Include UserMessage.sip
QCaObject.sip://sip      QCaObject( const QString& recordName, QObject *eventObject, UserMessage* userMessageIn );
QCaObject.sip://sip      void setUserMessage( UserMessage* userMessageIn );
QCaObject.sip://sip      void initialise( const QString& newRecordName, QObject *newEventHandler, UserMessage* userMessageIn );
QCaWidget.sip://sip    UserMessage userMessage;        


g++ -c -pipe -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2  -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT -DNDEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -I.
-I/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//widgets/include -I/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include
-I/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//api/include -I/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//plugins/include -I/usr/include/QtCore
-I/usr/include/QtGui -I/usr/include/python2.6 -I/usr/lib64/qt4/mkspecs/default -I/usr/include -I/usr/X11R6/include -o sipCaFrameworkQCaWidget.o sipCaFrameworkQCaWidget.cpp
In file included from /home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include/QCaObject.h:46,
                 from /home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include/QCaWidget.h:36,
                 from QCaWidget.sip:4:
/usr/include/QtCore/qobject.h: In copy constructor 'UserMessage::UserMessage(const UserMessage&)':
/usr/include/QtCore/qobject.h:309: error: 'QObject::QObject(const QObject&)' is private
/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include/UserMessage.h:38: error: within this context
In file included from QCaWidget.sip:4:
/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include/QCaWidget.h: In copy constructor 'QCaWidget::QCaWidget(const QCaWidget&)':
/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include/QCaWidget.h:43: note: synthesized method 'UserMessage::UserMessage(const UserMessage&)' first required here 
sipCaFrameworkQCaWidget.cpp: In constructor 'sipQCaWidget::sipQCaWidget(const QCaWidget&)':
sipCaFrameworkQCaWidget.cpp:59: note: synthesized method 'QCaWidget::QCaWidget(const QCaWidget&)' first required here 
sipCaFrameworkQCaWidget.cpp: In function 'void* init_QCaWidget(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)':
sipCaFrameworkQCaWidget.cpp:281: error: cannot allocate an object of abstract type 'sipQCaWidget'
sipCaFrameworkQCaWidget.cpp:22: note:   because the following virtual functions are pure within 'sipQCaWidget':
/home/cls1fs/epics/epics2//workspace/epicsqt/epicsqt-1.1.1-src//ca_framework//data/include/QCaWidget.h:60: note:    virtual qcaobject::QCaObject* QCaWidget::createQcaItem(unsigned int)
sipCaFrameworkQCaWidget.cpp:296: error: cannot allocate an object of abstract type 'sipQCaWidget'
sipCaFrameworkQCaWidget.cpp:22: note:   since type 'sipQCaWidget' has pure virtual functions
make: *** [sipCaFrameworkQCaWidget.o] Error 1
make: Leaving directory `/home/cls1fs/epics/epics2/workspace/epicsqt/epicsqt-1.1.1-src/ca_framework/sip/sipcode'

Well, it seems I have several different errors...


More information about the PyQt mailing list