Building QScintilla Python bindings from source

Davide Pesavento pesa at gentoo.org
Thu Jun 24 05:34:30 BST 2021


Hi,

I'm trying to build the python bindings for QScintilla v2.12.1 from
source on Linux and facing several issues. I'm using sip 6.1.1,
PyQt-builder 1.10.1, Qt 5.15.2, PyQt 5.15.4. I already compiled the
QScintilla C++ library against Qt 5 and installed it system-wide.

1/ The first issue is that sip-build cannot find QtCoremod.sip out-of-the-box.

$ sip-build --no-make --verbose
Querying qmake about your Qt installation...
/usr/bin/qmake -query
These bindings will be built: Qsci.
Generating the Qsci bindings...
sip-build: Unable to find file "QtCore/QtCoremod.sip"

I was able to fix this by adding the following two lines to pyproject.toml:

[tool.sip.project]
sip-include-dirs = ["/usr/share/sip/PyQt5"]

However, it seems odd that I have to edit pyproject.toml. Isn't there
a default system-wide search path for the .sip files? If so, shouldn't
PyQt5 install the files there for a better out-of-the-box experience?
Or maybe the QScintilla package should include the two lines above?
Either way, a command line option to specify the sip include dir would
feel a little less awkward than editing the pyproject.toml file.

2/ After "fixing" the previous issue, sip-build still fails:

$ sip-build --no-make --verbose
Querying qmake about your Qt installation...
/usr/bin/qmake -query
Checking to see if the Qsci bindings can be built...
/usr/bin/qmake Qsci.pro
Info: creating stash file
/tmp/portage/dev-python/qscintilla-python-2.12.1/work/QScintilla_src-2.12.1/Python/build/cfgtest_Qsci/.qmake.stash
make
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQSCINTILLA_DLL
-DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB
-DQT_CORE_LIB -I. -I/usr/include/qt5 -I/usr/include/qt5/QtPrintSupport
-I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui
-I/usr/include/qt5/QtCore -I. -I/usr/include/libdrm
-I/usr/lib64/qt5/mkspecs/linux-g++ -o cfgtest_Qsci.o
../../config-tests/cfgtest_Qsci.cpp
g++ -Wl,-O1 -o Qsci cfgtest_Qsci.o   -L/usr/lib64 -lqscintilla2_qt5
/usr/lib64/libQt5PrintSupport.so /usr/lib64/libQt5Widgets.so
/usr/lib64/libQt5Gui.so /usr/lib64/libQt5Core.so -lGL -lpthread
/tmp/portage/dev-python/qscintilla-python-2.12.1/work/QScintilla_src-2.12.1/Python/build/cfgtest_Qsci/./Qsci
/tmp/portage/dev-python/qscintilla-python-2.12.1/work/QScintilla_src-2.12.1/Python/build/cfgtest_Qsci/cfgtest_Qsci.out
These bindings will be built: Qsci.
Generating the Qsci bindings...
sip-build: Q_PID is undefined

This is where I'm stuck now and honestly I'm not sure how to debug this.

3/ This is merely a suggestion. The error messages from sip-build are
not particularly user friendly. In fact, at first it wasn't clear to
me that "Q_PID is undefined" was a fatal error at all... I only
realized that later when I couldn't find the generated Makefile.
Also I suppose it could be useful to print the path of the file being
processed when an error is encountered, or the location (file+line) of
the undefined reference (to Q_PID in this case). Again, just a
suggestion.

Thanks,
Davide


More information about the QScintilla mailing list