1

At first, I'm trying to install Qt with apt-get install qtchooser libgl-dev qt5-default qttools5-dev-tools python3.6 qtwebengine5-dev.
However, this install a Qt version of 5.9.
And I have tried to install Qt by using

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?

Based on two people's answer(thank you very much), I have update my .travis.yml like this:

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?

Hhry
  • 823
  • 1
  • 8
  • 19

3 Answers3

1

You can use one of Stephan Binner's launchpad repositories containing builds of recent Qt versions.

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):

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.

Also a note on one of the errors you see: the one about not being able to connect to any X display. 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:

services:
        - xvfb
Dmitry
  • 3,063
  • 2
  • 22
  • 32
1

Try to add the ppa manually in your travis configuration:

- os: linux
  dist: bionic
  sudo: require
  addons:
    apt:
      sources:
        - sourceline: 'ppa:beineri/opt-qt-5.13.2-bionic'
      packages:
        - qt513base
Patrick José Pereira
  • 1,613
  • 2
  • 11
  • 12
1

I could use some of the alternatives shown in the answers to question Silent install Qt run installer on ubuntu server.

In this case I see that the simplest solution is to use 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.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • Thank you for helping. I gave up ``5.13.2`` instead, I use ``5.12`` and everything work just fine. – Hhry Dec 11 '19 at 08:05
  • @Coel mmm, your question is clear: "Install Qt5.13 ..." so my answer is for that. If my answer helped you do not forget to mark as correct. – eyllanesc Dec 11 '19 at 08:07
  • Sure. I will try the method you suggest. – Hhry Dec 11 '19 at 08:10
  • @Coel Keep in mind that we only answer your question, we don't know or are interested in the changes you make to your project since our goal is just the question. – eyllanesc Dec 11 '19 at 08:10