本文介绍了无法从源代码构建 qtermwidget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从源代码构建 qtermwidget,但它给了我错误.
我已经成功构建了 lxqt-build-tools 然后从 pip3 安装了 pyqt5和贴切:

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

然后我运行了这个:

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

而且它工作正常.但是当我运行 make 命令时,它给了我这个错误:

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

我正在使用 gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0cmake version 3.16.0GNU Make 4.1 在基本操作系统 5.1 Hera 中.我曾经尝试从源代码构建 sippyqt5 ,但对我没有任何改变.

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.

推荐答案

Ubuntu 分发的 PyQt5 没有共享编译 QTermWidget 所需的 .sip,因此需要手动编译 sip 和 pyqt5.看来您尝试过但没有奏效,因为您似乎使用了错误的标志.综上所述,我分析了在 Arch Linux 中如何编译 sip、pyqt5 和 qtermwidget 并设法实现了一个 Dockerfile 允许我编译 QTermWidget.

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

这篇关于无法从源代码构建 qtermwidget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 19:49