Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Install qt 5 on Ubuntu: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:HowTo]] | [[Category:HowTo]] | ||
[[Category:Tutorial]] | |||
[[Category:QtCreator]] | |||
[toc align_right= | [toc align_right="yes" depth="2"] | ||
'''English''' [[Install_Qt_5_on_Ubuntu_Bulgarian|Български]] | '''English''' [[Install_Qt_5_on_Ubuntu_Bulgarian|Български]] | ||
Line 15: | Line 17: | ||
* '''Download''' | * '''Download''' | ||
Visit Qt downloads page an | Visit Qt downloads page an "download a 32-bit or 64-bit Linux installation":http://qt.io/download depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget. | ||
''Example:'' | ''Example:'' | ||
<code> | |||
wget http://download.qt.io/official_releases/qt/5.0/5.0.2/qt-linux-opensource-5.0.2-x86-offline.run | |||
</code> | |||
* '''Install''' | * '''Install''' | ||
Line 23: | Line 28: | ||
Adjust permission, run the installer and follow the instruction to complete the installation. | Adjust permission, run the installer and follow the instruction to complete the installation. | ||
<code> | <code> | ||
chmod +x qt-linux-opensource-5.0.2-x86-offline.run | |||
./qt-linux-opensource-5.0.2-x86-offline.run | |||
</code> | |||
* '''Install g+''* | * '''Install g+''* | ||
Launch '''Qt Creator'''. Go to '''Tools | Open a terminal and execute the following command to install g''+: | ||
<code> | |||
sudo apt-get install build-essential | |||
</code> | |||
''' '''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''' | * '''Install OpenGL libraries''' | ||
Execute the following command to install OpenGL libraries: | Execute the following command to install OpenGL libraries: | ||
<code> | |||
sudo apt-get install mesa-common-dev | |||
</code> | |||
Note: Just installing the above-mentioned mesa-common-dev kit is not sufficient for more recent Ubuntu versions. Based on this | 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":http://forum.qt.io/viewthread/23855/#110514 an additional package needs installation. Execute following command: | ||
<code> | |||
sudo apt-get install libglu1-mesa-dev -y | |||
</code> | |||
Tested with Qt5.3.1 and Ubuntu 14.04 and it solved the problem with missing -lGL. | |||
* '''Set file association with pro files''' | * '''Set file association with pro files''' | ||
When installing from the on-line source the file association is not done automatically. | 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. | |||
<code> | <code> | ||
[Desktop Entry] | |||
Version=1.0 | |||
Encoding=UTF-8 | |||
Type=Application | |||
Name=QtCreator | |||
Comment=QtCreator | |||
NoDsiplay=true | |||
Exec=(Install folder of QT)/Tools/QtCreator/bin/qtcreator %f | |||
Icon=(Install folder of QT)/5.4/Src/qtdoc/doc/images/landing/icon_QtCreator_78x78px.png | |||
Name[en_US]=Qt-Creator | |||
</code> | |||
Place this file in home .local/share/applications . | Place this file in home .local/share/applications . | ||
Edit a file named “defaults.list” in the same directory . | Edit a file named “defaults.list” in the same directory . | ||
Add the following line. | |||
<code> | <code> | ||
text/qtcreator=Qt-Creator.desktop; | |||
</code> | |||
open file mimeapps.list and check if the following line is present. | open file mimeapps.list and check if the following line is present. | ||
<code> | <code> | ||
application/vnd.nokia.qt.qmakeprofile=qtcreator.desktop | |||
</code> | |||
if not add it under [added Associations]. | if not add it under [added Associations]. | ||
Line 57: | Line 95: | ||
Run the following command. | Run the following command. | ||
<code> | <code> | ||
sudo update-mime-database /usr/share/mime | |||
</code> | |||
now Qt has been added to the list of file associations. | now Qt has been added to the list of file associations. | ||
Line 69: | Line 109: | ||
* '''error: g++: Command not found''' | * '''error: g++: Command not found''' | ||
''Solution:'' | ''Solution:'' | ||
<code> | |||
sudo apt-get install build-essential | |||
</code> | |||
* '''error: GL/gl.h: No such file or directory''' | * '''error: GL/gl.h: No such file or directory''' | ||
''Solution:'' | ''Solution:'' | ||
<code> | |||
sudo apt-get install mesa-common-dev |
Revision as of 13:21, 25 February 2015
[toc align_right="yes" depth="2"]
English Български
Install Qt 5 on Ubuntu
Introduction
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":http://qt.io/download depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget.
Example:
wget http://download.qt.io/official_releases/qt/5.0/5.0.2/qt-linux-opensource-5.0.2-x86-offline.run
- Install
Adjust permission, run the installer and follow the instruction to complete the installation.
chmod +x qt-linux-opensource-5.0.2-x86-offline.run
./qt-linux-opensource-5.0.2-x86-offline.run
- 'Install g+*
Open a terminal and execute the following command to install g+:
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:
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":http://forum.qt.io/viewthread/23855/#110514 an additional package needs installation. Execute following command:
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.
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=QtCreator
Comment=QtCreator
NoDsiplay=true
Exec=(Install folder of QT)/Tools/QtCreator/bin/qtcreator %f
Icon=(Install folder of QT)/5.4/Src/qtdoc/doc/images/landing/icon_QtCreator_78x78px.png
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.
text/qtcreator=Qt-Creator.desktop;
open file mimeapps.list and check if the following line is present.
application/vnd.nokia.qt.qmakeprofile=qtcreator.desktop
if not add it under [added Associations].
Run the following command.
sudo update-mime-database /usr/share/mime
now Qt has been added to the list of file associations.
Troubleshooting
- 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
Solution:
sudo apt-get install build-essential
- error: GL/gl.h: No such file or directory
Solution:
sudo apt-get install mesa-common-dev