【问题标题】:can not build qtermwidget from source无法从源代码构建 qtermwidget
【发布时间】:2020-04-01 10:12:39
【问题描述】:

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

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 命令时,它给了我这个错误:

[ 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

我在elementary OS 5.1 Hera 中使用gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 和cmake version 3.16.0 和GNU Make 4.1。我曾经尝试从源代码构建sip 和pyqt5,但对我没有任何改变。

【问题讨论】:

    标签: python pyqt5 python-sip


    【解决方案1】:

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

    所以考虑到上面的程序是:

    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
    

    【讨论】:

      猜你喜欢
      • 2014-01-22
      • 2020-08-11
      • 1970-01-01
      • 2015-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      相关资源
      最近更新 更多