Zieng Zieng - 5 months ago 224
Linux Question

How do I compile QScintilla and Eric6 on Linux?

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

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