QTermWidget PyQt6 bindings fail with error - qtermwidget.sip:14:10: fatal error: qtermwidget.h: No such file or directory
Hi, I'm new to pyQT and I'm trying to build python bindings for QTermWidget. I could compile and install qtermwidget library but when I try to create a python wheel using sip-wheel --verbose, i get the below error. What I'm I missing here. My QTermWidget is installed in installed to the default - /usr/local/
I see the same error with QT5 as well. I'm sure i'm missing something here.
Below is the log.
(6qtenv) nado@Host:~/QT6/qtermwidget/pyqt$ CXXFLAGS="-I$PWD/../lib -I$PWD/../build/lib -I/usr/local/include/qtermwidget6/" LDFLAGS="-L$PWD/../build" sip-wheel --verbose pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead Querying qmake about your Qt installation... /usr/local/Qt-6.6.0/bin/qmake -query These bindings will be built: QTermWidget. Generating the QTermWidget bindings... /home/nado/6qtenv/lib/python3.10/site-packages/PyQt6/bindings/QtCore/QtCoremod.sip: line 64: '%Plugin' is deprecated and will be removed in SIP v7.0.0 Generating the .pro file for the QTermWidget module... Generating the top-level .pro file... Generating the Makefiles... /usr/local/Qt-6.6.0/bin/qmake -recursive QTermWidget.pro Info: creating stash file /tmp/tmpfv7e8yf7/.qmake.stash Reading /tmp/tmpfv7e8yf7/QTermWidget/QTermWidget.pro Compiling the project... make cd QTermWidget/ && ( test -e Makefile || /usr/local/Qt-6.6.0/bin/qmake -o Makefile /tmp/tmpfv7e8yf7/QTermWidget/QTermWidget.pro ) && make -f Makefile make[1]: Entering directory '/tmp/tmpfv7e8yf7/QTermWidget' g++ -c -pipe -O2 -fno-exceptions -Wall -Wextra -D_REENTRANT -fPIC -DPy_LIMITED_API=0x03080000 -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I.. -I/usr/include/python3.10 -I/usr/local/Qt-6.6.0/include -I/usr/local/Qt-6.6.0/include/QtWidgets -I/usr/local/Qt-6.6.0/include/QtGui -I/usr/local/Qt-6.6.0/include/QtCore -I. -I/usr/local/Qt-6.6.0/mkspecs/linux-g++ -o sipQTermWidgetcmodule.o sipQTermWidgetcmodule.cpp /home/nado/QT6/qtermwidget/pyqt/sip/qtermwidget.sip:14:10: fatal error: qtermwidget.h: No such file or directory 14 | #include <qtermwidget.h> | ^~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [Makefile:575: sipQTermWidgetcmodule.o] Error 1 make[1]: Leaving directory '/tmp/tmpfv7e8yf7/QTermWidget' make: *** [Makefile:47: sub-QTermWidget-make_first-ordered] Error 2 sip-wheel: 'make' failed returning 2
Below is my build environment
QTermWidget Package version: 2.0.1
Distribution & Version: Ubuntu 22.04
Kernel: 6.5.0-44-generic
Qt Version: PyQt6 -
PyQt6==6.7.1
PyQt6-Qt6==6.7.2
PyQt6_sip==13.8.0
lxqt-build-tools Version: 2.0.0 (Compiled from source and installed to /usr/local).
QTBase : 6.6.0 (Compiled from source and installed to /usr/local)
qttools : 6.6.0 (Compiled from source and installed to /usr/local)
pyqt-builder : 1.16.4 (Installed using pip3)
Is it possible to install QTermWidget using apt-install on Ubuntu linux ? can qtermwidget be used with python on Ubuntu Linux. If yes, can you please suggest how to overcome this error during sip-wheel ?
Any help would be very much appreciated.
Thank you.
Hi Can anyone please suggest how to proceed.
I guess this may be about a simple mistake in compilation. But since I have no knowledge of this part of the code, I ask @yan12125.
@yan12125, could you please take a quick look?
Most likely the issue is that somehow -I/usr/local/include/qtermwidget6/ is specified in CXXFLAGS but not used by sip-wheel. No idea why that happens, though.
Has anyone use python qtermwidget on linux
I did basic testing of python qtermwidget from time to time on Arch Linux. @tsimonq2 may know more about Ubuntu.
If you replace <qtermwidget.h> by <qtermwidget6/qtermwidget.h> in the .sip file it works.
Thanks!
@yan12125, should we replace <qtermwidget.h> with <qtermwidget6/qtermwidget.h>, as suggested by @cemelo?
@yan12125, should we replace
<qtermwidget.h>with<qtermwidget6/qtermwidget.h>, as suggested by @cemelo?
I'd like to check what's going on before moving on. It's a little bit strange that <qtermwidget.h> fails and <qtermwidget6/qtermwidget.h> works. qtermwidget.h further includes several other header files in the qtermwidget6 folder (Emulation.h, Filter.h, etc.), so the qtermwidget6 folder should already be in the include path. @cemelo Mind to share your complete build logs?
@yan12125
Although I've read and made fixes to almost every part of qtermwidget since I started to maintain it, this part is an exception because of my poor knowledge of Python. So, please attend to it whenever you find the time.
Sure.
For this specific issue, the issue is more related to the C++, as the following line is copied as-is when a .cpp file is generated from the sip file. Hence, I asked for complete build log. https://github.com/lxqt/qtermwidget/blob/c3f6de38b1856b3b385933d3b4fae53de23ad39b/pyqt/sip/qtermwidget.sip#L14
error: qtermwidget.h: No such file or directory
i fixed this by setting include-dirs
in the tool.sip.bindings.name section of pyproject.toml
in qtermwidget.nix
cat >>pyproject.toml <<'EOF'
[tool.sip.project]
# fix: qtermwidget.sip: 'QtCore/QtCoremod.sip' could not be found
sip-include-dirs = [ "${pyqt6}/${python.sitePackages}/PyQt6/bindings" ]
# fix: _in_process.py: 'make' failed returning 2
# debug run_command in sipbuild/project.py
# https://stackoverflow.com/a/79740420/10440128
verbose = true
[tool.sip.bindings.QTermWidget]
# fix: error: qtermwidget.h: No such file or directory
include-dirs = [
"${pkgs-qtermwidget}/include/qtermwidget6",
]
# fix: ld: cannot find -lQt6Gui: No such file or directory
library-dirs = [
"${qt6.qtbase}/lib", # libQt6Gui.so libQt6Core.so
"${libGL}/lib", # libGLX.so libOpenGL.so
]
EOF