Installing Qt5

From Estone Technology Wiki
Jump to: navigation, search

Downloading Qt Creator 5.8.0

Note: This Qt 5.8.0 installation and testing was done between (Ubuntu 16.04.6 LTS 64-bit) host machine & EMB-2238

  • On host machine
$ cd ~/<build_dir>/
$ wget https://download.qt.io/archive/qt/5.8/5.8.0/qt-opensource-linux-x64-5.8.0.run
$ chmod +x qt-opensource-linux-x64-5.8.0.run
$ ./qt-opensource-linux-x64-5.8.0.run

Installing Qt

Note: Follow the Qt5.8.0 Setup Installer to install on host machine

1. In Qt 5.8.0 welcome screen installer press Next to go to next screen
Qt-5.8.0-1.png


2. On the next screen press the Skip button to continue
Qt-5.8.0-2.png


3. Press the Next button to continue to next step
Qt-5.8.0-3.png


4. Select the installation folder destination for Qt5.8.0, then press the Next button to continue
Qt-5.8.0-4.png


5. In Select Components window please select all components to install and press Next button

Note: In example we will select all to install
Qt-5.8.0-5.png


6. Select the button to confirm you have read and agree to the terms and license agreement and continue by pressing Next button
Qt-5.8.0-6.png


7. Press the Install button to install Qt 5.8.0
Qt-5.8.0-7.png


Note: Wait for Qt 5.8.0 install all the components
Qt-5.8.0-8.png


8. Once all the Qt 5.8.0 Components are installed press the Next button to finalize the Qt creator installation
Qt-5.8.0-9.png


9. Uncheck the Launch Qt Creator box and press Finish button to exit Qt installation
Qt-5.8.0-10.png


Installing Qt dependencies

  • Install g++

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

$ sudo apt-get install build-essential
  • Install generic font configuration library - runtime

execute the following command to install the full runtime files for the generic font configuration library:

$ sudo apt-get install libfontconfig1
  • Install OpenGL libraries

Execute the following command to install OpenGL libraries:

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


Qt 5.8.0 Configuration

Setting Up qtcreator.sh

  • We will configure the Qt Creator 5.8.0 before startup
$ cd ~/Qt5.8.0/Tools/QtCreator/bin/
$ sudo nano qtcreator.sh

Note: Make sure to add the environment setup directories into the first line of the qtcreator.sh fscript file (before #! bin/sh) as shown in the image below

Add Line: /opt/fsl-imx-xwayland/4.9.51-mx8-ga/environment-setup-aarch64-poky-linux
Qt-5.8.0-11.png

Ctrl+o to save qtcreator.sh
"Yes"
Ctrl+x to exit nano


Setting up dpkg-reconfigure

$ sudo dpkg-reconfigure dash

Note: When prompted package configuration press <No> to continue
Qt-5.8.0-12.png

$ . /opt/fsl-imx-xwayland/4.9.51-mx8-ga/environment-setup-aarch64-poky-linux qtcreator > /dev/null 2>&1


Starting Qt 5.8.0 Creator

  • This section will setup appropriate options to connect to EMB-2238
$ cd ~/Qt5.8.0/Tools/QtCreator/bin/
$ ./qtcreator.sh

Qt-5.8.0-13.png


Setting up EMB-2238 in Qt 5.8.0

1. In the Qt creator home window go to up to the options bar and choose Tools > Options...
2. In the Options.. window go to Devices and press on Add...to start the Device Wizard to connect to the new device
Qt-5.8.0-14.png


3. In Device Configuration Wizard Selection change device to (Generic Linux Device) and press Start Wizard button
Qt-5.8.0-15.png


4. In the Device Configuration Setup window change the following according to the EMB-2238 settings:

The name to identify this configuration: (emb-2238)
The device's host name or IP address: (192.168.1.65)
The username to log into the device: (root)
The authentication type: (password)
The user's password: (your password)/(default password: root)


5. Once these settings have been changed press Next > button to continue
Qt-5.8.0-16.png


6. Once you have finished the device configuration press Finish
Qt-5.8.0-17.png


7. Press the Test button and make sure the device test is successful and press Close button once device connected successfully
Qt-5.8.0-18.png


8. Once you have tested the EMB-2238 connection with the Qt Creator press Apply button on bottom right corner to save the device options.
Qt-5.8.0-19.png

Setting up Build & Run

  • This section will set up the Compilers, Qt Versions, Kits & Debuggers

Set up Compilers

1. Go to Build & Run > Compilers > Add > GCC > C to add new C compiler
Qt-5.8.0-20.png


2. Rename the new compiler emb2238-GCC, then press the Browse... button to look for the compiler executable you want to use
Qt-5.8.0-21.png


3. Navigate to the compiler path and choose aarch64-poky-linux-gcc as a compiler and Open
Compiler Path: /opt/fsl-imx-xwayland/4.9.51-mx8-ga/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
Qt-5.8.0-22.png


4. Go to Add > GCC > C++ to add new C++ compiler
Qt-5.8.0-20.png


5. Rename the new compiler emb2238-GCC++, then press the Browse... button to look for the compiler executable you want to use
Qt-5.8.0-23.png


6. Navigate to the compiler path and choose aarch64-poky-linux-g++ as a compiler and Open
Compiler Path: /opt/fsl-imx-xwayland/4.9.51-mx8-ga/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
Qt-5.8.0-24.png


7. Press Apply button on bottom right corner to apply the compiler settings
Qt-5.8.0-25.png


Set up Qt Versions

1. Go to Build & Run > Qt Versions > Add... to add qmake to Qt Versions
Qt-5.8.0-26.png


2. The select a qmake Executable window will open and we will choose the path to locate qmake
qmake Path: /opt/fsl-imx-xwayland/4.9.51-mx8-ga/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
Qt-5.8.0-27.png


3. Press Apply button on bottom right corner to apply the Qt Versions settings
Qt-5.8.0-28.png


Set up Debuggers

1. Go to Build & Run > Debuggers > Add and select a new Name then press Browse... to browse for a Debugger
Name: (emb2238-debug)
Debugger Path: /opt/fsl-imx-xwayland/4.9.51-mx8-ga/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
Qt-5.8.0-29.png


2. Navitate to the debugger path and choose aarch64-poky-linux-gdb as a debugger and press Open to open the file
Qt-5.8.0-30.png


3. Press Apply button to apply the Debugger Settings
Qt-5.8.0-31.png


Set up Kits

1. Go to Build & Run > Kits > Add to add a new kit for emb2238
Qt-5.8.0-32.png


2. After pressing the Add button fill in the following fields:
Name: emb2238
Device Type: Generic Linux Device
Device: emb2238 (default for Generic Linux)
Sysroot: /opt/fsl-imx-xwayland/4.9.51-mx8-ga/sysroots/aarch64-poky-linux
Compiler C: emb2238-GCC
Compiler C++: emb2238-GCC++
Debugger: emb2238-debug
Qt Version: Qt 5.8.0 (qt5)
Qt-5.8.0-33.png


2. Press Apply to apply and save Kits settings
Qt-5.8.0-34.png

Note: After these settings have been applied, go back to the home window of the Qt Creator


Starting a New Qt Project

  • In this section we will build a new simple "Hello World" Qt Console Application Project that we can deploy to the EMB-2238

1. In Qt Creator main window select New Project to start new project
Qt-5.8.0-35.png


2. In the New Project window press the type of application you want to create then press the Choose... button once type of application is chosen
- In this example we will create a Qt Console Application
Qt-5.8.0-36.png


3. Choose a name for the test application and browse to the directory where you want to store the application being created
4. Once the name and save directory are chosen press Next > button
Name: hello-world
Create In: /home/cesar-habey/qt-projects
Qt-5.8.0-37.png


5. Next choose the Kit Selection you created in the previous section emb2238 and uncheck your host system kit Desktop Qt 5.8.0 GCC 64bit
6. Press Next > button once the kit selection has been chosen
Qt-5.8.0-38.png


7. You can change the Project Management settings if required. For this Qt Application we will leave these settings Default


8. Press Finish to finish the settings for our "Hello World" test project
Qt-5.8.0-39.png


Running New Qt Project

Note: Now your Qt project will open in the Edit window which we will edit to run.

  • Now we will test our test our "Hello World" Qt Project and run on the EMB-2238

1. Go to the Edit section of the project and open the hello-world.pro file by double clicking the file