Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If you want to develop with QML 2.0 and Qt5, the base packages don't seem to exist in repository for 12.04. What PPA should I add? Is it a binary installer? a compile the toolkit yourself?

Those aren't separate questions, they're just possible tracks to an answer.

I'm asking because if you want to develop for Ubuntu Phone, but still have a rock solid LTS development box, this seems the appropriate path.

How can I install Qt 5.x on 12.04 LTS?

share|improve this question
up vote 36 down vote accepted

This can be done by adding the following PPA to your system:

ppa:canonical-qt5-edgers/ubuntu1204-qt5 Launchpad logo (Click here for instructions on using PPAs.)

You can usually do this with the following commands:

sudo apt-add-repository ppa:canonical-qt5-edgers/ubuntu1204-qt5
sudo apt-get update

The next step is to install the necessary packages for Qt5 / QML 2.0 development. You can do that by running these command:

sudo apt-get install qtdeclarative5-dev

This will install the headers / libraries necessary for development with desktop Qt and QML. You will also probably want to grab the latest release of Qt Creator from this page.

I've found that Qt Creator sometimes has problems finding your new Qt5 installation. If that is the case, perform these steps:

  1. open it up and go to Tools->Options
  2. click the "Build & Run" section in the left menu
  3. click the "Qt Versions" tab
  4. click "Add..." and enter the location that corresponds with your OS:

    32-bit: /usr/lib/i686-linux-gnu/qt5/bin/qmake
    64-bit: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake

Previously these packages were located here:

ppa:ubuntu-sdk-team/ppa Launchpad logo

According to the "Ubuntu SDK Team": Old Ubuntu 12.04 LTS Qt 5.0 packages have been moved to https://launchpad.net/~canonical-qt5-edgers/+archive/ubuntu/ubuntu1204-qt5/, and that seems to have occurred sometime in May of 2016.

share|improve this answer
1  
Adding that repository now suggests you should use "apt-add-repository ppa:ubuntu-sdk-team/ppa" instead. – Terence Eden Aug 5 '13 at 12:14
1  
Is there a way to install qt 5.2 with a similar method? I think the version provided on the PPA is 5.02 – Ezequiel Mar 21 '14 at 23:52
    
This version of Qt is giving me segfaults on window creation, when using the AMD proprietary fglrx graphics driver. Basically as described at forum.qt.io/topic/31293/… – interfect Apr 21 '15 at 23:42
    
Will this work for ubuntu 14.04.04 LTS as well? – Yonatan Simson May 26 at 7:53

Ubuntu SDK team PPA (ppa:ubuntu-sdk-team/ppa) provides only Qt 5.0 for Ubuntu 12.04.

If you need features from newer Qt versions you can use the new PPAs by Stephan Binner for Precise and Trusty. He created PPAs for all Qt version starting from 4.8.

In order to not mess with Qt system packages, the packages from this PPA are installed in /opt so you'll have to inform the correct path (/opt/qtXX/include) to your build tool (if you don't use the Qt Creator provided by the PPA).


Instructions

  1. Choose a PPA

    From Stephan's profile page on Launchpad, choose the PPA that matches the Qt version you want and the Ubuntu version you have. Remember that Precise is Ubuntu 12.04 and Trusty is Ubuntu 14.04.

    Supposing you want to install Qt 5.5 on Ubuntu 12.04 you should choose Qt 5.5.1 for /opt Precise (the latest Qt version available for Precise at the time of this writing).

    To install Qt 5.5 on Ubuntu 14.04 choose Qt 5.5.1 for /opt Trusty.

  2. Add the PPA to your system

    Open the PPA page. You should see something like this:

    enter image description here

    Then run apt-add-repository followed by the bold text from above (use the actual PPA address from the PPA page!):

    sudo apt-add-repository ppa:beineri/opt-qt551
    
  3. Update package lists an install Qt

    Run the following to download the package list from the added repository and install Qt (and Qt Creator):

    sudo apt-get update
    sudo apt-get install qt-latest qtcreator-latest
    
share|improve this answer
    
Stephan's PPA helped me resolve an unresolved qDebug() symbol issue on 14.04.3 where my compiled library version was 5.5.0 but my run-time was 5.2.1 (on a different machine). I installed qt55declarative and then used source /opt/qt55/bin/qt55-env.sh before running my program. – Lucas Dec 11 '15 at 19:46
    
Will this work on 14.04 or 16.04? – Suici Doga Feb 8 at 2:37
    
@SuiciDoga Answer updated. There are PPAs for Ubuntu 14.04, but not for 16.04 (yet). – Eric Carvalho Feb 8 at 15:01
    
@EricCarvalho Thanks – Suici Doga Feb 8 at 15:12
    
W: Failed to fetch ppa.launchpad.net/beineri/opt-qt551/ubuntu/dists/trusty/main/… 404 Not Found – owaishanif786 Feb 17 at 14:02

The way to install Qt 5.*:

sudo apt-get install build-essential libgl1-mesa-dev
share|improve this answer
1  
-1 This installs a compiler suite and development files for OpenGL, not Qt. – David Foerster Dec 20 '15 at 11:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.