How do I compile QScintilla and Eric6 on Linux?

3.6k views Asked by At

First I install QScintilla by following steps:

1:

cd Qt4Qt5
qmake qscintilla.pro
sudo make
make install

2:

cd ../designer-Qt4Qt5
qmake designer.pro
sudo make
sudo make install

3:

cd ../Python
python3 configure.py --pyqt=PyQt5
sudo make

And here I met the problem :

QAbstractScrollArea: No such file or directory 

and problem:

qprinter.h: No such file or directory

But I finally solved them by manually add required files.

Goes on:

sudo make install

4:

then I go to install eric6 by typing:

sudo python3 install.py

But I got:

Checking dependencies

Python Version: 3.4.0

Found PyQt5

Sorry, please install QScintilla2 and its PyQt5/PyQt4 wrapper.

Error: /usr/lib/python3/dist-packages/PyQt5/Qsci.so: undefined symbol: _ZTI13QsciScintilla

3

There are 3 answers

4
ekhumoro On BEST ANSWER

The main problem is that you are linking against Qt4 rather than Qt5. This is why the QAbstractScrollArea and QPrinter headers are reported as missing, and why you later get the undefined symbol error.

QScintilla uses a features file to control compile-time configuration, and its sources need to be patched to get a good build for Qt5.

So first unpack a fresh set of sources, and then make these changes:

designer-Qt4Qt5/designer.pro:

TARGET = qscintillaplugin_qt5

Qt4Qt5/features/qscintilla2.prf:

        } else {
            LIBS += -lqscintilla2_qt5
        }
    }
} else {
    LIBS += -lqscintilla2_qt5
}

Qt4Qt5/qscintilla.pro:

TARGET = qscintilla2_qt5
...
features.path = $$[QT_INSTALL_ARCHDATA]/mkspecs/features

This will ensure that you get independent qscintilla libs for Qt5.

With that done, take the following steps to build (as a normal user):

cd 'path/to/src/Qt4Qt5'

# this is essential for correct linking
export QMAKEFEATURES="$PWD/features"

# make sure you use the right qmake!
qmake-qt5 'qscintilla.pro'
make

# plugin for Qt5 Designer
cd '../designer-Qt4Qt5'
qmake-qt5 'designer.pro' INCLUDEPATH+='../Qt4Qt5' QMAKE_LIBDIR+='../Qt4Qt5'
make

# Python bindings
cd '../Python'
python3 'configure.py' --pyqt='PyQt5' --qmake='/usr/bin/qmake-qt5' \
        --qsci-incdir='../Qt4Qt5' --qsci-libdir='../Qt4Qt5'
make

If successful, you can then install everything (as root):

cd 'path/to/src/Qt4Qt5'
make install

cd '../designer-Qt4Qt5'
make install

cd '../Python'
make install
0
ony On

I guess the most important is --pyqt=PyQt5 which leads to using sip/qscimod5.sip instead of sip/qscimod4.sip. Difference is that it contains line %Import QtWidgets/QtWidgetsmod.sip which is essential for QAbstractScrollArea.

0
user192127 On

ekhumoro's solution above did not quite work for me - let's just say maybe I missed something, or it's an environment-specific thing.

Anyway.... I did what ekhumoro advised except didn't edit these three files: (XXX)

- designer-Qt4Qt5/designer.pro
- Qt4Qt5/features/qscintilla2.prf
- Qt4Qt5/qscintilla.pro

the reason for editing them seems sound, but at the end of the day Eric install failed with:

Sorry, please install QScintilla2 and its PyQt5/PyQt4 wrapper.
Error:     
dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyQt5/Qsci.so, 2):
Library not loaded: libqscintilla2_qt5.12.dylib
                                  ^^^^
Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/PyQt5/Qsci.so
Reason: image not found

note the _qt5 marked with ^^^^ - theoretically that should resolve, but for me it did not. I tried all kinds of things to no avail. May be my ignorance of some setting.

I expected ekhumoro's instructions to work, since the edits suggested for the 3 files - see (XXX) - configure Make to create libraries with _qt5. I tried many things - symlinks, etcetc., but at the end of the day, leaving out (XXX) allowed everything to proceed properly.

So - in summary, *if you don't need to have QScintilla work simultaneously with PyQt4 and PyQt5*, do ekhumoro's advice minus the stuff at (XXX) - that way, Eric should install without problems.

Take care with the information above: it will probably clobber QScintilla libs for Qt4