Click here to Skip to main content
14,668,357 members
Articles » Platforms, Frameworks & Libraries » Cross Platform » Qt
Tip/Trick
Posted 13 Apr 2014

Stats

53.4K views
14 bookmarked

Installing Qt on Linux

Rate this:
5.00 (5 votes)
Please Sign up or sign in to vote.
5.00 (5 votes)
18 Oct 2014CPOL
A brief step-by-step guide on what is needed to get Qt and the Qt Creator installed on your Linux environment

Introduction

Installing Qt is usually an easy task, yet it can be frustrating if you try to install it on Linux. I use Unumtu 12.04 LTS running on a Parallels VM to explain the process, yet is should be applicable to almost any Linuy distribution.

Background - What do you need?

Package Description
Installation packages

Qt

The Qt framework, e.g. the Qt Creator, all libraries and everything needed in relation to Qt

OpenGL

Qt uses OpenGL to render GUI elements. It isn't included with the Qt installation package and needs to be installed via apt-get

GNU g++ compiler

The GNU g++ compiler isn't included with the Qt installation package, either. You can use another compiler (GPP for example), but g++ is recommended by digia.

Installation

Before you start, it is recommended to run

sudo apt-get update && sudo apt-get upgrade 

and

sudo apt-get autoremove

on your Terminal in order to ensure that your system is up-to-date and doesn't contain any obsolete or outdated packages.

After this, get the Qt installation package from the Digia download page. Before you can run it, you need to adjust the permissions on the downloaded file:

 
chmod +x /home/parallels/Downloads/qt-opensource-linux-x64-5.2.1.run

chmod +x adds the permission to run the file as executable for anyone on the computer, meaning that anyone can use the file to install Qt. After you have done that, you need to execute the file in order to install Qt.

Congratulations, you have installed Qt - But there is still more than just something missing. For example, you can't compile anything yet. To install g++, type

sudo apt-get install build-essential

in your Terminal. This will install the g++ compiler (and generally development related stuff) - You don't need to adjust anything with your Qt Creator settings, it will automatically detect the newly installed compiler the next time you start it.

In order to install OpenGL you need to run

sudo apt-get install mesa-common-dev

and

sudo apt-get install libcr-dev

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

from your Terminal. The first command installs OpenGL while the second two command install some development-related additional OpenGL libraries which aren't required for non-development related activities, but needed to build Qt source code which is using OpenGL features.

If you plan on using any SSL encryption (KQOAuth for example requires this), make sure to install the libressl development package:

sudo apt-get libssl-dev

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Marco Bertschi
Software Developer
Switzerland Switzerland
I'm a young Software Engineer. Whilst I may accept a 'status quo' as given, it's my responsibility to improve it as soon as the opportunity arises.
Very familiar with the .Net framework since it has been the underlying foundation for most of my professional work so far. I'm that kind of guy who gets stuff done, while I may also improve the way things work whilst I'm at it. Generally can get along well with most people I meet as a professional.
Fervent volunteer firefigter, captain-ranked air force militia spec officer.
Great friend and generally nice to have me around - For a talk, a beer, or a bonfire (I might as well do all of those things combined). Oh, and I really love music - Rock & country that is, mostly.

Comments and Discussions

 
QuestionInstalling Qt on Linux Pin
Member 1282866829-May-17 22:04
MemberMember 1282866829-May-17 22:04 
Questionthanx Pin
crowja19-Sep-15 17:56
Membercrowja19-Sep-15 17:56 
QuestionInstalling Qt on a Beaglebone? Pin
Marc Clifton12-Oct-14 12:52
mvaMarc Clifton12-Oct-14 12:52 
AnswerRe: Installing Qt on a Beaglebone? Pin
Marco Bertschi14-Oct-14 22:50
professionalMarco Bertschi14-Oct-14 22:50 
QuestionDo u work on Qt ? Pin
Madhan Mohan Reddy P15-Jun-14 23:06
professionalMadhan Mohan Reddy P15-Jun-14 23:06 
AnswerRe: Do u work on Qt ? Pin
Marco Bertschi16-Jun-14 3:51
professionalMarco Bertschi16-Jun-14 3:51 
GeneralRe: Do u work on Qt ? Pin
Madhan Mohan Reddy P16-Jun-14 23:06
professionalMadhan Mohan Reddy P16-Jun-14 23:06 
GeneralRe: Do u work on Qt ? Pin
Marco Bertschi16-Jun-14 23:12
professionalMarco Bertschi16-Jun-14 23:12 
GeneralRe: Do u work on Qt ? Pin
Madhan Mohan Reddy P16-Jun-14 23:14
professionalMadhan Mohan Reddy P16-Jun-14 23:14 
GeneralRe: Do u work on Qt ? Pin
Marco Bertschi16-Jun-14 23:17
professionalMarco Bertschi16-Jun-14 23:17 
GeneralRe: Do u work on Qt ? Pin
Madhan Mohan Reddy P16-Jun-14 23:20
professionalMadhan Mohan Reddy P16-Jun-14 23:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.