How to Install Qt SDK on Ubuntu Linux

The Qt Software Development Kit (SDK) is a cross-platform application framework that is widely used for developing application software with a graphical user interface (GUI). Some of the well known applications developed with Qt are KDE, Opera, Google Earth and Skype. It is a portable cross platform application user interface framework which works on the Windows, Linux and Mac OS X operating systems. Qt SDK helps you create graphical user interfaces (GUI's) for your applications that will run on Windows, Linux and Mac OS X. For more detailed information on the Qt SDK please see the Qt SDK website. For additional information on creating your first Qt program please see the following document How to Create Your First Qt Program on Ubuntu Linux.

Note: This document covers the installation of 64-bit version of Qt SDK 4.8 and Qt SDK 5.0, software development kit on Ubuntu Linux and will also work for Debian and Linux Mint.

Qt SDK 4.8 Installation Instructions:

Determine your Ubuntu Linux operating system bit version by opening up a terminal and typing the following below and download the matching Qt SDK bit version for your operating system.

For example, if you are on 32-bit Ubuntu Linux then download 32-bit Qt SDK, if you are on 64-bit Ubuntu Linux then download 64-bit Qt SDK.

  • Type/Copy/Paste: file /sbin/init
  • Note the bit version of your Ubuntu Linux operating system architecture it will display whether it is 32-bit or 64-bit.

WH.shared.addScrollLoadItem(‘bb42723129d989b3ae634af97e896c6f’)

  • Select your Ubuntu Linux system architecture such as 32-bit or 64-bit version of the Qt SDK. Also you can add development libraries so that you are able to run Qt applications without complications by following these steps.
  • Note: When it comes to downloading the SDK, download the offline installation due to the fact it takes a long time to download unless you have a really fast download connection.
  • You have two methods when it comes to downloading the Qt SDK the online installer method or the offline installer method. Some prefer to just download the full SDK using the offline method. Because the classes that make up Qt SDK are so large it takes several hours on a slow connection to download the SDK. This may or may not be a turn off for some users who want to try out the Qt SDK.
  • Suggestion: Try using the offline installer instead of the online installer unless you have a really fast connection.

Open up a terminal and enter the following commands below:

  • Type/Copy/Paste: sudo apt-get install synaptic
  • Type/Copy/Paste: sudo apt-get update
  • This command is used to update and to resynchronize the package index files from their sources via the Internet.
  • Type/Copy/Paste: sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui
  • This command adds additional Qt development libraries to your Ubuntu Linux system allowing Qt programs to run smoothly on your system.

Type/Copy/Paste:

cd /home//Downloads

  • This will change you into the Downloads directory on your system

Type/Copy/Paste:

sudo -s chmod u+x QtSdk-offline-linux-x86_64-v1.2.1.run

  • This will make the Qt SDK executable for all users on your system

WH.shared.addScrollLoadItem(‘5d9bd40d3a4833d6bd8e1765f2b020e3’)

  • Type/Copy/Paste: sudo -s ./QtSdk-offline-linux-x86_64-v1.2.1.run -style cleanlooks
  • You must have superuser privileges to install the Qt SDK

Install the Qt SDK.

You will prompted to select a directory where you want the Qt SDK to reside. Select /opt and your Qt SDK will install into a directory called /opt/QtSDK

WH.shared.addScrollLoadItem(‘b4426d6e4ee7b8b892a14943b5b44b28’)

Type/Copy/Paste:

sudo -s chmod -R 777 /opt/QtSDK

  • This will make the Qt SDK executable for all users on your system

Type/Copy/Paste:

sudo -s chmod -R 777 /home//.config/Nokia

  • This will prevent error messages when you start QtCreator, stating it can not write to the /home/”your_user_name”/.config/Nokia directory.

Wait until the Qt program is installed, open up a terminal and use a text editor such as nano or gedit to edit your /etc/profile.

  • Type/Copy/Paste: sudo -s nano /etc/profile
  • or
  • Type/Copy/Paste: sudo -s gedit /etc/profile

Scroll down to the end of the /etc/profile file and enter the following text below.

You want to add this line below to your /etc/profile system wide file so that you will have the option to compile Qt programs from the terminal line.

Type/Copy/Paste:

  • PATH=/opt/QtSDK/Desktop/Qt/4.8.1/gcc/bin:$PATH
  • export PATH

Check.

The above number highlighted in bold denotes the version number of the Qt SDK so make sure you enter the correct version number of the Qt SDK. The Qt SDK is always improving with new version changes. So make sure you are mindful of your Qt SDK version number.

  • For example, we are using Qt version 4.8.1 in this example, therefore the version number in the /etc/profile would reflect as 4.8.1.

WH.shared.addScrollLoadItem(‘eb5b0e3776b074a58d1b0889c562f404’)

WH.shared.addScrollLoadItem(‘ac73cbbb36aac42dd601c55675faab1e’)

  • Type/Copy/Paste: . /etc/profile
  • Make sure you enter a . and then a space in order to reload your /etc/profile file

Wait until the /etc/profile file is reloaded – issue the following command you can type the following commands to make sure your Ubuntu Linux system recognizes that the Qt SDK has been accepted by the system PATH.

Type/Copy/Paste:

which qmake

  • You should receive a response such as the one below
  • /opt/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake

Also type the following command below:

  • Type/Copy/Paste: qmake -version

Receive a response similar to this:

  • ‘QMake version 2.01a
  • ‘Using Qt version 4.8.1 in /opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib

Know that you are able to compile Qt programs from the command line.

Now you are all set to compile Qt programs on your Ubuntu Linux system. Once the Qt SDK is successfully installed on your system you might want to try compiling your first Qt program see this document for more information How to Create Your First Qt Program on Ubuntu Linux.

Qt SDK 5.0 Installation Instructions:

Determine your Ubuntu Linux operating system bit version by opening up a terminal and typing the following below and download the matching Qt SDK bit version for your operating system.

For example, if you are on 32-bit Ubuntu Linux then download 32-bit Qt SDK, if you are on 64-bit Ubuntu Linux then download 64-bit Qt SDK.

  • Type/Copy/Paste: file /sbin/init
  • Note the bit version of your Ubuntu Linux operating system architecture it will display whether it is 32-bit or 64-bit.

WH.shared.addScrollLoadItem(’15b2916ea632fc56465c880f08caf14e’)

  • Select your Ubuntu Linux system architecture such as 32-bit or 64-bit version of the Qt SDK. Also you can add development libraries so that you are able to run Qt applications without complications by following these steps.
  • Note: When it comes to downloading the SDK, download the offline installation due to the fact it takes a long time to download unless you have a really fast download connection.
  • You have two methods when it comes to downloading the Qt SDK the online installer method or the offline installer method. Some prefer to just download the full SDK using the offline method. Because the classes that make up Qt SDK are so large it takes several hours on a slow connection to download the SDK. This may or may not be a turn off for some users who want to try out the Qt SDK.
  • Suggestion: Use the offline installer instead of the online installer unless you have a really fast connection.

Open up a terminal and enter the following commands below:

  • Type/Copy/Paste: sudo apt-get install synaptic
  • Type/Copy/Paste: sudo apt-get update
  • This command is used to update and to resynchronize the package index files from their sources via the Internet.
  • Type/Copy/Paste: sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui
  • This command adds additional Qt development libraries to your Ubuntu Linux system allowing Qt programs to run smoothly on your system. This information is included just in case you want to have Qt SDK 4.8 compatible libraries installed
  • Type/Copy/Paste: sudo apt-get install build-essential
  • this will add additional C/C++ libraries for compilation
  • Type/Copy/Paste: sudo apt-get install “^libxcb.*” libx11-xcb-dev libglu1-mesa-dev libxrender-dev
  • this will add OpenGL functionality when running your Qt applications

Type/Copy/Paste:

cd /home//Downloads

  • This will change you into the Downloads directory on your system

Type/Copy/Paste:

sudo -s chmod u+x qt-linux-opensource-5.0.2-x86_64-offline.run

  • This will make the Qt SDK executable for all users on your system

WH.shared.addScrollLoadItem(‘eda38c4d8213430587e676218d44958d’)

  • Type/Copy/Paste: sudo -s ./qt-linux-opensource-5.0.2-x86_64-offline.run -style cleanlooks
  • You must have superuser privileges to install the Qt SDK

Install the Qt SDK.

You will be prompted to select a directory where you want the Qt SDK to reside. Select /opt and your Qt SDK will install into a directory called /opt/QtSDK

WH.shared.addScrollLoadItem(‘e64114a61ae4759179452b47f8e2fb58’)

Type/Copy/Paste:

sudo -s chmod -R 777 /opt/Qt5.0.2

  • This will make the Qt SDK executable for all users on your system

Type/Copy/Paste:

sudo -s chmod -R 777 /home//.config/QtProject

  • This will prevent error messages when you start QtCreator, stating it can not write to the /home/”your_user_name”/.config/QtProject directory.

Have the Qt program is installed, open up a terminal and use a text editor such as nano or gedit to edit your /etc/profile.

  • Type/Copy/Paste: sudo -s nano /etc/profile
  • or
  • Type/Copy/Paste: sudo -s gedit /etc/profile

Scroll down to the end of the /etc/profile file and enter the following text below.

You want to add this line below to your /etc/profile system wide file so that you will have the option to compile Qt programs from the terminal line.

Type/Copy/Paste:

  • PATH=/opt/Qt5.0.2/5.0.2/gcc/bin:$PATH
  • export PATH

Check.

The above number highlighted in bold denotes the version number of the Qt SDK so make sure you enter the correct version number of the Qt SDK. The Qt SDK is always improving with new version changes. So make sure you are mindful of your Qt SDK version number.

  • For example, we are using Qt version 5.0.2 in this example, therefore the version number in the /etc/profile would reflect as 5.0.2

WH.shared.addScrollLoadItem(’37fb12a814c8a01527a82814900f3768′)

WH.shared.addScrollLoadItem(’31c42b04a516163f7c071fd04a216ff0′)

  • Type/Copy/Paste: . /etc/profile
  • Make sure you enter a . and then a space in order to reload your /etc/profile file

Have the /etc/profile file reloaded.

Issue the following command you can type the following commands to make sure your Ubuntu Linux system recognizes that the Qt SDK has been accepted by the system PATH.

Type/Copy/Paste:

which qmake

  • You should receive a response such as the one below
  • /opt/Qt5.0.2/5.0.2/gcc/bin/qmake

Type the following command below:

  • Type/Copy/Paste: qmake -version

Receive a response similar to this:

  • QMake version 3.0
  • Using Qt version 5.0.2 in /opt/Qt5.0.2/5.0.2/gcc/lib

Know that you are able to compile Qt SDK 5.0 programs from the command line.

Now you are all set to compile Qt programs on your Ubuntu Linux system. Once the Qt SDK is successfully installed on your system you might want to try compiling your first Qt program see this document for more information How to Create Your First Qt Program on Ubuntu Linux.

Leave a Comment