EMB-2237-AI: Installing/Testing Qt5 Creator

From Estone Technology Wiki
Jump to: navigation, search

Downloading Qt Creator 5.10.1

Note: This Qt 5.10.1 installation and testing was done between (Ubuntu 18.04.4 LTS 64-bit bionic) host machine & EMB-2237-AI

  • On (Linux) host machine
$ cd ~/<build_dir>/
$ wget -c https://download.qt.io/archive/qt/5.10/5.10.1/qt-opensource-linux-x64-5.10.1.run
$ chmod +x qt-opensource-linux-x64-5.10.1.run
$ ./qt-opensource-linux-x64-5.10.1.run


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


Installing Qt

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

1. In Qt 5.10.1 welcome screen installer press Next to go to next screen
Emb-2237-ai-qt5-1.2.png


2. Login to your Qt account, if you do not have a Qt account create one and login, then press the Next button to continue
Emb-2237-ai-qt5-2.2.png


3. Press the Next button on the 'Welcome' window to continue to next step
Emb-2237-ai-qt5-3.2.png


4. Select the installation directory destination for Qt5.10.1, then press the Next button to continue
Emb-2237-ai-qt5-4.2.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
Emb-2237-ai-qt5-5.2.png


6. Press the Circle button to confirm you have read and agree to the terms and license agreement and continue by pressing the Next button
Emb-2237-ai-qt5-6.2.png


7. Press the Install button to install Qt 5.10.1
Note: Qt will take around 3-5 minutes to install and will take 3.59 GiB of disk space
Emb-2237-ai-qt5-7.2.png


Note: Wait for Qt 5.10.1 install all the components
Emb-2237-ai-qt5-8.png


8. Once all the Qt 5.10.1 Components are installed press the Next button to finalize the Qt creator installation
Emb-2237-ai-qt5-9.2.png


9. Uncheck the Launch Qt Creator box and press Finish button to exit Qt installation
Emb-2237-ai-qt5-10.2.png

Qt 5.10.1 Configuration

Setting Up qtcreator.sh

  • We will configure the Qt Creator 5.10.1 before startup
$ cd ~/Qt5.10.1/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-wayland/4.14-sumo/environment-setup-aarch64-poky-linux
Emb-2237-ai-qt5-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
Emb-2237-ai-qt5-12.2.png

$ . /opt/fsl-imx-wayland/4.14-sumo/environment-setup-aarch64-poky-linux qtcreator > /dev/null 2>&1

Starting Qt 5.10.1 Creator

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

Emb-2237-ai-qt5-13.png


Setting up EMB-2237-AI in Qt Creator

1. In the Qt Creator home window go 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
Emb-2237-ai-qt5-14.2.png


3. In Device Configuration Wizard Selection change device to (Generic Linux Device) and press Start Wizard button to continue
Emb-2237-ai-qt5-15.2.png


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

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


5. Once these settings have been changed press Next > button to continue
Emb-2237-ai-qt5-16.2.png


6. Once you have finished the device configuration press Finish
Emb-2237-ai-qt5-17.2.png


7. Press the Test button and make sure the device test is successful and press Close button once device connected successfully
Emb-2237-ai-qt5-18.2.png


8. Once you have tested the EMB-2237-AI connection with the Qt Creator press Apply button on bottom right corner to save the device options.
Emb-2237-ai-qt5-19.2.png

Setting up Build & Run

  • This section will set up the Compilers, Qt Versions, Kits & Debuggers to work with EMB-2237-AI

Set up Compilers

1. Go to Build & Run > Compilers > Add > GCC > C to add new C compiler
Emb-2237-ai-qt5-20.2.png


2. Rename the new compiler emb2237-ai-GCC, then press the Browse... button to look for the compiler executable you want to use
Emb-2237-ai-qt5-22.2.png


3. Navigate to the compiler path and choose aarch64-poky-linux-gcc as a compiler and Open
Compiler Path: /opt/fsl-imx-wayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
Emb-2237-ai-qt5-21.2.png


4. Go to Add > GCC > C++ to add new C++ compiler
Emb-2237-ai-qt5-20.2.png


5. Rename the new compiler emb2237-ai-C++, then press the Browse... button to look for the compiler executable you want to use
Emb-2237-ai-qt5-24.2.png


6. Navigate to the compiler path and choose aarch64-poky-linux-g++ as a compiler and Open
Compiler Path: /opt/fsl-imx-wayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
Emb-2237-ai-qt5-23.2.png


7. Press Apply button on bottom right corner to apply the compiler settings
Emb-2237-ai-qt5-24.3.png


Set up Qt Versions

1. Go to Build & Run > Qt Versions > Add... to add qmake to Qt Versions
Emb-2237-ai-qt5-25.2.png


2. Select the qmake Executable window and navigate to the path to locate qmake
qmake Path: /opt/fsl-imx-wayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
Emb-2237-ai-qt5-26.2.png


3. Press Apply button on bottom right corner to apply the Qt Versions settings
Emb-2237-ai-qt5-27.2.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: (emb2237-ai-gdb)
Debugger Path: /opt/fsl-imx-wayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
Emb-2237-ai-qt5-28.2.png


2. Navitate to the debugger path and choose aarch64-poky-linux-gdb as a debugger and press Open to open the file
Emb-2237-ai-qt5-29.2.png


3. Press Apply button to apply the Debugger Settings
Emb-2237-ai-qt5-30.2.png

Set up Kits

1. Go to Build & Run > Kits > Add to add a new kit for emb-2237-ai
Emb-2237-ai-qt5-31.2.png


2. After pressing the Add button fill in the following fields:
Name: emb-2237-ai
Device Type: Generic Linux Device
Device: emb-2237-ai (default for Generic Linux)
Sysroot: /opt/fsl-imx-wayland/4.14-sumo/sysroots/aarch64-poky-linux
Compiler C: emb-2237-ai-GCC
Compiler C++: emb-2237-ai-C++
Debugger: emb-2237-ai-gdb
Qt Version: Qt 5.10.1 (qt5)
Emb-2237-ai-qt5-32.2.png


2. Press Apply to apply and save Kits settings
Emb-2237-ai-qt5-32.3.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-2237-AI

1. In Qt Creator main window select New Project to start new project
Emb-2237-ai-qt5-33.2.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 has been chosen
- In this example we will create a Qt Console Application
Emb-2237-ai-qt5-34.2.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/<user>/Qt5.10.1/projects
Emb-2237-ai-qt5-35.2.png


5. Define which build system you want to use: qmake
Press the Next > button once you have chosen build system
Emb-2237-ai-qt5-36.2.png


5. Next choose the Kit Selection you created in the previous section emb-2237-ai and uncheck your host system kit Desktop Qt 5.10.1 GCC 64bit
6. Press Next > button once the kit selection has been chosen
Emb-2237-ai-qt5-37.2.png


7. You can change the Project Management settings if required. For this Qt Application we will leave these settings Default
Emb-2237-ai-qt5-38.2.png


8. Press Finish to finish the settings for our "hello-world" test project
Emb-2237-ai-qt5-38.3.png


Testing Qt Project

  • Now we will test our test "hello-world" Qt project and run on the EMB-2237-AI

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


2. Edit the following lines in .pro file:

 16 linux-*{
 17    target.path =/home
 18    INSTALLS += target
 19 }

Emb-2237-ai-qt5-40.1.png


3. In the hello-world project go to Sources > main.cpp and open the main.cpp file to edit the following lines:

2 #include <iostream>
3 #include <stdlib.h>
4
5 using namespace std;
--------------------------------------------
10
11   cout<<”Hello World”<<endl;
12

Emb-2237-ai-qt5-40.2.png


4. Once these lines have been edited for both of the files, build the application by pressing on the build icon on the bottom left corner of the Qt Creator
Note: You can follow the output of the build by pressing on the Compile Output button on the Qt program window
Emb-2237-ai-qt5-41.png

Emb-2237-ai-qt5-42.png


5. Next, you can deploy the application by pressing on the green Play button on the bottom left corner of the screen or press the Play-Debug button beneath the play button to deploy the application with debug properties
Emb-2237-ai-qt5-43.png

Emb-2237-ai-qt5-43.2.png


6. If the application deployed correctly with no errors to EMB-2237-AI there will be output with no errors Emb-2237-ai-qt5-44.png


7. Once the application has been successfully deployed to the EMB-2237-AI, you can open the EMB-2237-AI terminal/command-line and run the demo Qt application: ./hello-world
Emb-2237-ai-qt5-45.png


-- Demo Qt Project has been successfully deployed to the EMB-2237-AI --