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

111,535

Solution 1

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.

Solution 2

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:
111,535

Related videos on Youtube

RobotHumans
Author by

RobotHumans

My thoughts Me on launchpad PPA Evidently one of my mini-apps was useful enough to make it on to Webupd8 Do you use/like that app? Maybe you want to help fund a cryptogram game Hit my daily rep cap for the first time Nov 22 2010 Just made it to page 3 ons SU on dec 31 in users ranked by rep.. yay....first gold badge. unsung hero I use various linux distros as my primary OSes of choice(tending to stay away from rpm based). Moving into using FreeBSD as my primary OS. --Resume-- Degrees BS:IT focus Network Security MS:ISA Certifications G2700 Certified Ethical Hacker, CHFI, EDRP CCNA, CCNA Security, CCIE Candidate(CCIE written now expired, the others are current) MCITP Enterprise administrator server 2k8/Vista Network+, Security+, Project+(all lifetime) CIW Associate, Professional, Javascript, Database CNSS 4011 recognition Accomplishments 1st in the state, 6th in the nation networking concepts Phi Beta Lambda leadership conferences (it's like the college version of FBLA) On the national science olympiad team from my high school Kenpo - black belt Experience 7 yrs in small business IT services (varied) --/Resume-- Favourite quotations: "A failure to plan on your part does not constitute an emergency on my part" --Unknown "If debugging is the process of removing bugs, then programming must be the process of putting them in" --Edsger Dijkstra

Updated on September 18, 2022

Comments

  • RobotHumans
    RobotHumans almost 2 years

    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?

  • Terence Eden
    Terence Eden almost 11 years
    Adding that repository now suggests you should use "apt-add-repository ppa:ubuntu-sdk-team/ppa" instead.
  • Ezequiel
    Ezequiel over 10 years
    Is there a way to install qt 5.2 with a similar method? I think the version provided on the PPA is 5.02
  • interfect
    interfect about 9 years
    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/…
  • Lucas
    Lucas over 8 years
    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.
  • David Foerster
    David Foerster over 8 years
    -1 This installs a compiler suite and development files for OpenGL, not Qt.
  • Suici Doga
    Suici Doga over 8 years
    Will this work on 14.04 or 16.04?
  • Eric Carvalho
    Eric Carvalho over 8 years
    @SuiciDoga Answer updated. There are PPAs for Ubuntu 14.04, but not for 16.04 (yet).
  • bawa g
    bawa g over 8 years
  • Yonatan Simson
    Yonatan Simson about 8 years
    Will this work for ubuntu 14.04.04 LTS as well?