[PyQt] QScintilla2 for Qt4/Qt45 Co-installability

Scott Kitterman debian at kitterman.com
Fri Mar 28 04:24:09 GMT 2014


On Thursday, March 27, 2014 20:47:54 Scott Kitterman wrote:
> On Sunday, March 09, 2014 17:26:13 Phil Thompson wrote:
> > On 09-03-2014 4:41 pm, Scott Kitterman wrote:
> > > Sigh. Phone auto correct. ..
> > > 
> > >  Debian/Ubuntu
> > >  
> > >  Scott K
> > > 
> > > On March 9, 2014 9:48:30 AM EDT, Scott Kitterman
> > > 
> > > <debian at kitterman.com> wrote:
> > >> Ive been investigating extending the Deviant/Unintuitive packages
> > >> for QScintilla2 to also build for Qt5.
> > >> 
> > >> Both the build for Qt4 and Qt5 produce identically named
> > >> libqscintilla2 so files. I can easily mark the packages as
> > >> conflicting so they cant be installed at the same time, but that
> > >> seems less than ideal.
> > >> 
> > >> Do you have any suggestions about how to proceed on making the
> > >> libraries co-installable?
> > 
> > The current snapshot installs a qscintilla2.prf file so that is now the
> > recommended way of adding QScintilla to a .pro file. That then makes it
> > more acceptable to call the library different names when compiled
> > against different versions of Qt.
> 
> I think I have the library piece of it figured out now.  I am stuck on
> configuring the Python bindings to build with Qt5.  Here's what I have so
> far for the Python configure command when I'm trying to build with Qt5
> (QSciQt5 is the directory where the Qt5 build of the library is done):
> 
> python$* ../configure.py -n ../../QSciQt5/ -o ../../QSciQt5 \
>    --sip-incdir=/usr/include/python$* -c --pyqt=PyQt5 --qmake=/usr/bin/qmake
> \ --destdir=/usr/lib/python$*/dist-packages/PyQt5;
> 
> This configures, but not fully for Qt5.  In the generated Qsci.pro file,
> there is:
> 
> api.path = /usr/share/qt4/api/python
> 
> Also the Qt include path when compiling the extenstion is still Qt4 (and
> nothing in the .pro says it should be different.  It looks like setting --
> pyqt=PyQt5 only affects there the files go by default, not what Qt version
> is actually used during the build.
> 
> How do I pass options to qmake and how do I set api.path?

Nevermind about that.  I figured it out.  I changed python ... add 
QT_SELECT=qt5 in front of it and now both the includes and the api setting is 
correct.

New problem.   For Qt4, it builds fine, but for Qt5, I get this error:

g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -
DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG -DQT_PLUGIN -
DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/i386-linux-gnu/qt5/mkspecs/linux-g++ -I. 
-I../../QSciQt5 -I/usr/include/python3.4m -I/usr/include/python3.4m -
I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o 
sipQscipart0.o sipQscipart0.cpp
In file included from ../../QSciQt5/Qsci/qscicommand.h:36:0,
                 from ../../QSciQt5/Qsci/qsciscintilla.h:42,
                 from 
/tmp/buildd/qscintilla2-2.8.1/Python/sip/qsciscintilla.sip:29:
../../QSciQt5/Qsci/qsciscintillabase.h:35:31: fatal error: 
QAbstractScrollArea: No such file or directory
 #include <QAbstractScrollArea>
                               ^
compilation terminated.

In Qt4, QAbstractScrollArea is in QtGui and in Qt5 it's in QtWidgets which I 
have installed, but (as you can see) isn't included.  I manually added it to 
the generated Makefile for testing and got past the, to then fail on this:

In file included from 
/tmp/buildd/qscintilla2-2.8.1/Python/sip/qsciprinter.sip:31:0:
../../QSciQt5/Qsci/qsciprinter.h:38:22: fatal error: qprinter.h: No such file 
or directory
 #include <qprinter.h>
                      ^
compilation terminated.

For Qt5, qprinter.h is in QtPrintSupport instead of QtGui.  So I added that 
manually to the Makefile.

After those two additions, it compiled for Qt5.  Is there a configure option I 
need to add to get those included?

Scott K


More information about the PyQt mailing list