can not build qtermwidget from source

北城余情 提交于 2021-01-27 21:31:51

问题


I'm trying to build qtermwidget from source, but it gives me error.
I've successfully built lxqt-build-tools and then installed pyqt5 from both pip3 and apt:

sudo -H pip3 install -U pyqt5 pyqtwebengine
sudo apt install python3-sip-dev python3-pyqt5

and then I ran this:

mkdir -p /tmp/EAF && cd /tmp/EAF
git clone https://github.com/lxqt/qtermwidget  
cd qtermwidget  
mkdir build && cd build  
cmake .. -DQTERMWIDGET_BUILD_PYTHON_BINDING=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr

and it works fine. but when I run make command, it gives me this error:

[ 87%] Built target qtermwidget5
Byte-compiling /tmp/EAF/qtermwidget/build/pyqt//__init__.py to /tmp/EAF/qtermwidget/build/pyqt//__pycache__/__init__.cpython-36.pyc
[ 87%] Built target __tmp_EAF_qtermwidget_build_pyqt____pycache_____init__.cpython-36.pyc
[ 89%] Generating sip/sipQTermWidgetpart0.cpp, sip/sipQTermWidgetpart1.cpp, sip/sipQTermWidgetpart2.cpp, sip/sipQTermWidgetpart3.cpp, sip/sipQTermWidgetpart4.cpp, sip/sipQTermWidgetpart5.cpp, sip/sipQTermWidgetpart6.cpp, sip/sipQTermWidgetpart7.cpp

sip: Unable to find file "QtGui/QtGuimod.sip"
pyqt/CMakeFiles/python_module_QTermWidget.dir/build.make:62: recipe for target 'pyqt/sip/sipQTermWidgetpart0.cpp' failed
make[2]: *** [pyqt/sip/sipQTermWidgetpart0.cpp] Error 1
make[2]: *** Deleting file 'pyqt/sip/sipQTermWidgetpart0.cpp'
CMakeFiles/Makefile2:179: recipe for target 'pyqt/CMakeFiles/python_module_QTermWidget.dir/all' failed
make[1]: *** [pyqt/CMakeFiles/python_module_QTermWidget.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

I'm using gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 and cmake version 3.16.0 and GNU Make 4.1 in elementary OS 5.1 Hera. I once tried building sip and pyqt5 from source, didn't change anything for me.


回答1:


The PyQt5 distributed by Ubuntu does not share the necessary .sip to compile QTermWidget so it is necessary to compile sip and pyqt5 manually. It seems you tried and it didn't work since it seems you used the wrong flags. Considering the above, I analyzed how sip, pyqt5 and qtermwidget are compiled in Arch Linux and managed to implement a Dockerfile that allowed me to compile QTermWidget.

So considering the above the procedure is:

sudo apt-get update && apt-get install \
    -y --no-install-recommends \
    build-essential \
    git \
    ca-certificates \
    wget \
    cmake \
    pkg-config \
    python3-dev \
    libglib2.0-dev \
    qt5-default \
    qttools5-dev

mkdir -p /tmp/EAF

cd /tmp/EAF && \
    git clone https://github.com/lxqt/lxqt-build-tools.git \
    && cd lxqt-build-tools \
    && mkdir build && cd build \
    && cmake .. \
    && make && sudo make install

cd /tmp/EAF && \
    wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.19/sip-4.19.19.tar.gz && \
    tar xvzf sip-4.19.19.tar.gz && \
    cd sip-4.19.19 && \
    python3 configure.py --sip-module PyQt5.sip && \
    make && \
    sudo make install

cd /tmp/EAF && \
    wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.13.2/PyQt5-5.13.2.tar.gz && \
    tar xvzf PyQt5-5.13.2.tar.gz && \
    cd PyQt5-5.13.2 && \
    python3 configure.py --confirm-license && \
    make && \
    sudo make install

cd /tmp/EAF && \
    git clone https://github.com/lxqt/qtermwidget \
    && cd qtermwidget \
    && mkdir build && cd build \
    && cmake .. -DQTERMWIDGET_BUILD_PYTHON_BINDING=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/lib \
    && make && sudo make install


来源:https://stackoverflow.com/questions/59229716/can-not-build-qtermwidget-from-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!