The wiki is in the process of moving to Please make your edits there.

Install_Qt_5_on_Ubuntu | Qt Wiki | Qt Project

English Български

Install Qt 5 on Ubuntu


This is a tutorial for installation of Qt 5.0.2 to Ubuntu 12.10. It may be used also for newer versions of Qt and Ubuntu. A difference for OpenGL has been found and added as a note below.

Installation Guide

  • Download

Visit Qt downloads page an download a 32-bit or 64-bit Linux installation [] depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget.


  1. wget

  • Install

Adjust permission, run the installer and follow the instruction to complete the installation.

  1. chmod +x
  2. ./

  • Install g++

Open a terminal and execute the following command to install g++:

  1. sudo apt-get install build-essential

  • Configure a compiler

Launch Qt Creator. Go to Tools > Options. Click Build & Run and select tab Kit. Configure a compiler if it is not automatically detected.

  • Install OpenGL libraries

Execute the following command to install OpenGL libraries:

  1. sudo apt-get install mesa-common-dev

Note: Just installing the above-mentioned mesa-common-dev kit is not sufficient for more recent Ubuntu versions. Based on this comment in the forum [] an additional package needs installation. Execute following command:

  1. sudo apt-get install libglu1-mesa-dev -y

Tested with Qt5.3.1 and Ubuntu 14.04 and it solved the problem with missing -lGL.

  • Set file association with pro files

When installing from the on-line source the file association is not done automatically.
It also not show up when you try to associate it with file explorer.
Create a file named “Qt-Creator.desktop” and fill the file with the following.

  1. [Desktop Entry]
  2. Version=1.0
  3. Encoding=UTF-8
  4. Type=Application
  5. Name=QtCreator
  6. Comment=QtCreator
  7. NoDsiplay=true
  8. Exec=(Install folder of QT)/Tools/QtCreator/bin/qtcreator %f
  9. Icon=(Install folder of QT)/5.4/Src/qtdoc/doc/images/landing/icon_QtCreator_78x78px.png
  10. Name[en_US]=Qt-Creator

Place this file in home .local/share/applications .

Edit a file named “defaults.list” in the same directory .
Add the following line.

  1. text/qtcreator=Qt-Creator.desktop;

open file mimeapps.list and check if the following line is present.

  1. application/

if not add it under [added Associations].

Run the following command.

  1. sudo update-mime-database /usr/share/mime

now Qt has been added to the list of file associations.


  • Qt Creator needs a compiler set up to build

Follow the instruction from the previous section to configure compiler for Qt Creator.

  • error: g++: Command not found


  1. sudo apt-get install build-essential

  • error: GL/gl.h: No such file or directory


  1. sudo apt-get install mesa-common-dev