简体   繁体   English

在 travis-ci linux 上安装 Qt5.13

[英]Install Qt5.13 on travis-ci linux

At first, I'm trying to install Qt with apt-get install qtchooser libgl-dev qt5-default qttools5-dev-tools python3.6 qtwebengine5-dev .起初,我试图用apt-get install qtchooser libgl-dev qt5-default qttools5-dev-tools python3.6 qtwebengine5-dev安装Qt。
However, this install a Qt version of 5.9.但是,这安装了 5.9 的 Qt 版本。
And I have tried to install Qt by using我尝试使用安装 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;

And this gave another error:这给出了另一个错误:

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

What is the proper solution to install Qt 5.13 on travis-ci linux?在 travis-ci linux 上安装 Qt 5.13 的正确解决方案是什么?

Based on two people's answer(thank you very much), I have update my .travis.yml like this:根据两个人的回答(非常感谢),我更新了我的.travis.yml如下:

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

However, another error appear:但是,出现另一个错误:

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.

How to solve that?如何解决?

You can use one of Stephan Binner 's launchpad repositories containing builds of recent Qt versions.您可以使用Stephan Binner的启动板存储库之一,其中包含最新 Qt 版本的构建。

For example, if you want to use Qt 5.13.1, you can write the following in your .travis.yml 's install section (assuming you use xenial build image):例如,如果您想使用 Qt 5.13.1,您可以在.travis.ymlinstall部分中编写以下内容(假设您使用xenial构建映像):

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

Add other Qt packages as you need.根据需要添加其他 Qt 包。

Also a note on one of the errors you see: the one about not being able to connect to any X display.还有一个关于您看到的错误的注释:关于无法连接到任何 X 显示器的错误。 If whatever you want to run on Travis CI normally requires GUI to run, you can use xvfb to work around this issue: for this to work you need to add the following to the top level of your .travis.yml :如果您想在 Travis CI 上运行的任何内容通常需要运行 GUI,您可以使用xvfb来解决此问题:为此,您需要将以下内容添加到.travis.yml

services:
        - xvfb

Try to add the ppa manually in your travis configuration:尝试在您的 travis 配置中手动添加 ppa:

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

I could use some of the alternatives shown in the answers to question Silent install Qt run installer on ubuntu server .我可以使用问题的答案中显示的一些替代方案在 ubuntu 服务器上静默安装 Qt 运行安装程序

In this case I see that the simplest solution is to use qtci :在这种情况下,我看到最简单的解决方案是使用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

In this project I use the previous script to run an example of Qt.这个项目中,我使用前面的脚本来运行一个 Qt 示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM