在travis-ci linux上安装Qt5.13

时间:2019-12-10 13:47:21

标签: linux qt travis-ci

首先,我尝试使用apt-get install qtchooser libgl-dev qt5-default qttools5-dev-tools python3.6 qtwebengine5-dev安装Qt。
但是,这将安装5.9的Qt版本。
我已经尝试通过使用

来安装Qt
sudo wget http://download.qt.io/official_releases/qt/5.13/5.13.1/qt-opensource-linux-x64-5.13.1.run;
sudo chmod +x ./qt-opensource-linux-x64-5.13.1.run;
sudo ./qt-opensource-linux-x64-5.13.1.run;

这又带来了另一个错误:

QStandardPaths: wrong ownership on runtime directory /run/user/2000, 2000 instead of 0
qt.qpa.screen: QXcbConnection: Could not connect to display 
Could not connect to any X display

在travis-ci linux上安装Qt 5.13的正确解决方案是什么?

基于两个人的回答(非常感谢),我已经像这样更新了.travis.yml

addons:
        apt:
          sources:
            - sourceline: 'ppa:beineri/opt-qt-5.13.2-bionic'
          packages:
            - qt513base
            - qt513tools
            - qt513webengine
            - qt513x11extras
            - qt513translations
            - qt513scxml
            - qt513script

但是,出现另一个错误:

ome packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 qt513webengine:i386 : Depends: qt513base:i386 but it is not going to be installed
                       Depends: qt513declarative:i386 but it is not going to be installed
                       Depends: qt513location:i386 but it is not going to be installed
                       Depends: qt513quickcontrols2:i386 but it is not going to be installed
                       Depends: qt513webchannel:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如何解决?

3 个答案:

答案 0 :(得分:1)

您可以使用Stephan Binner的启动板存储库之一,其中包含最新的Qt版本。

例如,如果您想使用Qt 5.13.1,则可以在.travis.yml的{​​{1}}部分中编写以下内容(假设您使用install构建映像):< / p>

xenial

根据需要添加其他Qt软件包。

还请注意您看到的错误之一:关于无法连接到任何X显示器的错误。如果要在Travis CI上运行的任何程序通常都需要运行GUI,则可以使用xvfb来解决此问题:要使其正常工作,您需要在sudo apt-add-repository -y ppa:beineri/opt-qt-5.12.1-xenial && travis_wait 30 sudo apt-get -qq update && sudo apt-get -qq install qt512tools qt512base && source /opt/qt512/bin/qt512-env.sh 的顶层添加以下内容:

.travis.yml

答案 1 :(得分:1)

尝试在travis配置中手动添加ppa:

- os: linux
  dist: bionic
  sudo: require
  addons:
    apt:
      sources:
        - sourceline: 'ppa:beineri/opt-qt-5.13.2-bionic'
      packages:
        - qt513base

答案 2 :(得分:1)

我可以使用问题Silent install Qt run installer on ubuntu server的答案中显示的一些替代方法。

在这种情况下,我看到最简单的解决方案是使用qtci

language: generic

dist: bionic

addons:
    apt:
        packages:
            - libxkbcommon-x11-0
            - libgl1-mesa-dev

services: 
    - xvfb

env:
    - QT_CI_PACKAGES=qt.qt5.5132.gcc_64,qt.qt5.5132.qtwebengine PATH="$TRAVIS_BUILD_DIR/Qt/5.13.2/gcc_64/bin:${PATH}"

script:
    - git clone https://github.com/benlau/qtci.git
    - source qtci/path.env
    - install-qt 5.13.2

this project中,我使用前面的脚本来运行Qt的示例。