How to install the Qt SDK on the Ubuntu distribution of Linux

Table of contents:

How to install the Qt SDK on the Ubuntu distribution of Linux
How to install the Qt SDK on the Ubuntu distribution of Linux
Anonim

Qt's SDK ("Software Development Kit") is a cross-platform application framework that is widely used to develop applications with a graphical user interface (or "GUI" for " Graphical User Interface "in English). Among the applications developed with Qt, there are notably KDE, Opera, Google Earth and Skype. It is a cross-platform GUI application framework that is portable and works on Mac OS X, Lonux and Windows operating systems. Qt's SDK helps you create graphical user interfaces (or GUIs) for applications that can run on both Mac OS X, Linus, and Windows. For more information on the Qt SDK, see the Qt SDK website. For more information on how to create your first program with Qt, see this tutorial.

Remark:

this article details the installation of the 64-bit version of Qt SDK 4.8 and of Qt SDK 5.0, SDKs for the Ubuntu distribution of Linux, which will also work for Debian and Linux Mint.

Steps

Method 1 of 2: Qt SDK version 4.8 installation instructions

Install Qt SDK on Ubuntu Linux Step 1

Step 1. To get started, look at which version (bitwise) of Ubuntu you are using, by opening a terminal and entering the command below

Then download the corresponding version of the Qt SDK for your operating system. For example, if you are on a 32-bit version of the Ubuntu distribution of Linux, download the 32-bit SDK from Qt. If you are on a 64-bit version of the Ubuntu distribution of Linux, download the 64-bit SDK from Qt.

  • Type or copy / paste:

    file / sbin / init

  • Take note of the version (its number of bits) of the Ubuntu system architecture that will be displayed, either 32-bit or 64-bit.
Install Qt SDK on Ubuntu Linux Step 2

Step 2. Then download the Qt SDK

  • Choose the version of Qt's SDK that matches the Ubuntu system architecture you have. You can also add software libraries, so that you can launch Qt applications without complications, by following the steps below.
  • Remark:

    when you download the SDK, take the "offline" version because it takes less time to download, unless you have a very high speed connection.

  • There are two methods you can choose to download the Qt SDK: the online installer method and the offline installer method. It is often preferable to directly download the entire SDK via the offline method. As the classes in Qt's SDK are very heavy, it takes several hours to download the SDK with a slow connection. This may not be a problem for users just wanting to try Qt's SDK.
  • Suggestion:

    it is strongly recommended to use the installer offline rather than online, unless you have a really fast connection.

Install Qt SDK on Ubuntu Linux Step 3

Step 3. Open a terminal and enter the following commands there:

  • Type or copy / paste:

    sudo apt-get install synaptic

  • Type or copy / paste:

    sudo apt-get update

  • This command is used to update and synchronize the index files of packages from their sources on the Internet.
  • Type or copy / paste:

    sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

  • This command adds additional software libraries to your machine, allowing you to run Qt programs cleanly on your computer.
Install Qt SDK on Ubuntu Linux Step 4

Step 4. Type or copy / paste:

cd / home /"Your username"/ Downloads

This will take you to the Downloads (or Downloads) folder on your system

Install Qt SDK on Ubuntu Linux Step 5

Step 5. Type or copy / paste:

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

This will make the Qt SDK executable by all users of the machine

Install Qt SDK on Ubuntu Linux Step 6

Step 6. To install the Qt SDK, enter the following command

  • Type or copy / paste:

    sudo -s./QtSdk-offline-linux-x86_64-v1.2.1.run -style cleanlooks

  • You will need to have super user rights to be able to install the Qt SDK.
Install Qt SDK on Ubuntu Linux Step 7

Step 7. You will be asked to choose the folder where to install the Qt SDK

Choose / opt and the Qt SDK will be installed in a directory named / opt / QtSDK.

Install Qt SDK on Ubuntu Linux Step 8

Step 8. Change the access permissions to the folder where the Qt SDK is located so that it is accessible to all users by entering the following command

Install Qt SDK on Ubuntu Linux Step 9

Step 9. Type or copy / paste:

sudo -s chmod -R 777 / opt / QtSDK

This will make the Qt SDK executable by all users of the machine

Install Qt SDK on Ubuntu Linux Step 10

Step 10. Type or copy / paste:

sudo -s chmod -R 777 / home /"Your username"/.config/Nokia

  • This will prevent the display of error messages when launching QCreator, saying that the software cannot write to the / home / folder."Your username"/.config/Nokia.
Install Qt SDK on Ubuntu Linux Step 11

Step 11. Once the Qt software is installed, open a command terminal and use a text editor like gedit or nano to edit the / etc / profile file

  • Type or copy / paste:

    sudo -s nano / etc / profile

  • Where
  • Type or copy / paste:

    sudo -s gedit / etc / profile

Install Qt SDK on Ubuntu Linux Step 12

Step 12. Scroll down to the bottom of the / etc / profile file and type the text below

This line must be added to the / etc / profile system file in order to have the option of compiling Qt programs from the terminal.

Install Qt SDK on Ubuntu Linux Step 13

Step 13. Type or copy / paste:

  • PATH = / opt / QtSDK / Desktop / Qt /4.8.1/ gcc / bin: $ PATH
  • export PATH
Install Qt SDK on Ubuntu Linux Step 14

Step 14. The bolded number above indicates the version number of Qt's SDK, so be sure to put the version number that matches the SDK you are installing

Qt's SDK is constantly improving with new versions. So double check your version number.

  • For example, we use the version 4.8.1 of Qt in our case, the version number indicated in / etc / profile should therefore be 4.8.1.
Install Qt SDK on Ubuntu Linux Step 15

Step 15. Save the / etc / profile file and close it

Install Qt SDK on Ubuntu Linux Step 16

Step 16. Reload the / etc / profile file using the following command

  • Type or copy / paste:

    . / etc / profile

  • Make sure you put a period followed by a space in order to reload the / etc / profile file.
Install Qt SDK on Ubuntu Linux Step 17

Step 17. Once the / etc / profile file has been modified, enter the following command to ensure that your system recognizes the Qt SDK correctly by having included it in the PATH

Install Qt SDK on Ubuntu Linux Step 18

Step 18. Type or copy / paste:

which qmake

  • You should receive a response like the one below.
  • /opt/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake
Install Qt SDK on Ubuntu Linux Step 19

Step 19. Also enter the command below

  • Type or copy / paste:

    qmake -version

Install Qt SDK on Ubuntu Linux Step 20

Step 20. You should receive a response like the one below

  • QMake version 2.01a
  • Using Qt version 4.8.1 in /opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib
Install Qt SDK on Ubuntu Linux Step 21

Step 21. This tells you that you can now compile Qt programs from the command line

You are now ready to compile Qt programs on your Ubuntu machine. Once the Qt SDK is properly installed on your computer, you will want to start compiling your first Qt programs. Check out this tutorial for more information.

Method 2 of 2: Qt SDK Version 5.0 Installation Instructions

Install Qt SDK on Ubuntu Linux Step 22

Step 1. To get started, look at what version (bitwise) of Ubuntu you are using, by opening a terminal and entering the command below

Then download the corresponding version of the Qt SDK for your operating system. For example, if you are on a 32-bit version of the Ubuntu distribution of Linux, download the 32-bit SDK from Qt. If you are on a 64-bit version of the Ubuntu distribution of Linux, download the 64-bit SDK from Qt.

  • Type or copy / paste:

    file / sbin / init

  • Take note of the version (its number of bits) of the Ubuntu system architecture that will be displayed, either 32-bit or 64-bit.
Install Qt SDK on Ubuntu Linux Step 23

Step 2. Then download the Qt SDK

  • Choose the version of Qt's SDK that matches the Ubuntu system architecture you have. You can also add software libraries, so that you can launch Qt applications without complications, by following the steps below.
  • Remark:

    when you download the SDK, take the "offline" version because it takes less time to download, unless you have a very high speed connection.

  • You can choose between two methods to download the Qt SDK: the online installer method and the offline installer method. It is often preferable to directly download the entire SDK via the offline method. As the classes in Qt's SDK are very heavy, it takes several hours to download the SDK with a slow connection. This may not be a problem for users just wanting to try Qt's SDK.
  • Suggestion:

    it is strongly recommended to use the installer offline rather than online, unless you have a really fast connection.

Install Qt SDK on Ubuntu Linux Step 24

Step 3. Open a terminal and enter the following commands there:

  • Type or copy / paste:

    sudo apt-get install synaptic

  • Type or copy / paste:

    sudo apt-get update

  • This command is used to update and synchronize the index files of packages from their sources on the Internet.
  • Type or copy / paste:

    sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

  • This command adds additional software libraries to your machine, allowing you to run Qt programs cleanly on your computer. These instructions have been included in case you want Qt SDK 4.8 compatible libraries installed.
  • Type or copy / paste:

    sudo apt-get install build-essential

  • This will add additional C / C ++ libraries for compilation.
  • Type or copy / paste:

    sudo apt-get install "^ libxcb. *" libx11-xcb-dev libglu1-mesa-dev libxrender-dev

  • This will add OpenGL functionality to your Qt applications when you run them.
Install Qt SDK on Ubuntu Linux Step 25

Step 4. Type or copy / paste:

cd / home /"Your username"/ Downloads

This will take you to the Downloads (or Downloads) folder on your system

Install Qt SDK on Ubuntu Linux Step 26

Step 5. Type or copy / paste:

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

This will make the Qt SDK executable by all users of the machine

Install Qt SDK on Ubuntu Linux Step 27

Step 6. To install the Qt SDK, enter the following command

  • Type or copy / paste:

    sudo -s./qt-linux-opensource-5.0.2-x86_64-offline.run -style cleanlooks

  • You will need to have super user rights to be able to install the Qt SDK.
Install Qt SDK on Ubuntu Linux Step 28

Step 7. You will be asked to choose the folder where to install the Qt SDK

Choose / opt and the Qt SDK will be installed in a directory named / opt / QtSDK.

Install Qt SDK on Ubuntu Linux Step 29

Step 8. Change the access permissions to the folder where the Qt SDK is located so that it is accessible to all users by entering the following command

Install Qt SDK on Ubuntu Linux Step 30

Step 9. Type or copy / paste:

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

This will make the Qt SDK executable by all users of the machine

Install Qt SDK on Ubuntu Linux Step 31

Step 10. Type or copy / paste:

sudo -s chmod -R 777 / home /"Your username"/.config/QtProject

  • This will prevent the display of error messages when launching QCreator, saying that the software cannot write to the / home / folder."Your username"/.config/QtProject.
Install Qt SDK on Ubuntu Linux Step 32

Step 11. Once the Qt software is installed, open a command terminal and use a text editor like gedit or nano to edit the / etc / profile file

  • Type or copy / paste:

    sudo -s nano / etc / profile

  • Where
  • Type or copy / paste:

    sudo -s gedit / etc / profile

Install Qt SDK on Ubuntu Linux Step 33

Step 12. Scroll to the bottom of the / etc / profile file and type the text below

This line must be added to the / etc / profile system file in order to have the option of compiling Qt programs from the terminal.

Install Qt SDK on Ubuntu Linux Step 34

Step 13. Type or copy / paste:

  • PATH = / opt /Qt5.0.2 / 5.0.2 /gcc / bin: $ PATH
  • export PATH
Install Qt SDK on Ubuntu Linux Step 35

Step 14. The bolded number above indicates the version number of Qt's SDK, so be sure to put the version number that matches the SDK you are installing

The Qt SDK is constantly improving with new versions. So double check your version number.

  • For example, we use the version 5.0.2 of Qt in our case, the version number indicated in / etc / profile should therefore be 5.0.2.
Install Qt SDK on Ubuntu Linux Step 36

Step 15. Save the / etc / profile file and close it

Install Qt SDK on Ubuntu Linux Step 37

Step 16. Reload the / etc / profile file using the following command

  • Type or copy / paste:

    . / etc / profile

  • Make sure you put a period followed by a space in order to reload the / etc / profile file.
Install Qt SDK on Ubuntu Linux Step 38

Step 17. Once the / etc / profile file has been modified, enter the following command to ensure that your system recognizes the Qt SDK correctly by having included it in the PATH

Install Qt SDK on Ubuntu Linux Step 39

Step 18. Type or copy / paste:

which qmake

  • You should receive a response like the one below.
  • /opt/Qt5.0.2/5.0.2/gcc/bin/qmake
Install Qt SDK on Ubuntu Linux Step 40

Step 19. Also enter the command below

  • Type or copy / paste:

    qmake -version

Install Qt SDK on Ubuntu Linux Step 41

Step 20. You should receive a response like the one below

  • QMake version 3.0
  • Using Qt version 5.0.2 in /opt/Qt5.0.2/5.0.2/gcc/lib
Install Qt SDK on Ubuntu Linux Step 42

Step 21. This tells you that you can now compile Qt programs using SDK version 5.0 from the command line

You are now ready to compile Qt programs on your Ubuntu machine. Once the Qt SDK is properly installed on your computer, you will want to start compiling your first Qt programs. Check out this tutorial for more information.

Popular by topic