Yocto Qt Creator: Difference between revisions

From Variscite Wiki
 
(23 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use MORTY_BETA_DART-6UL as default
<!-- Set release according to "release" parameter in URL and use MORTY_BETA_DART-6UL as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-6UL}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_BETA_DART-6UL}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Yocto QT5 Toolchain Installation}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#vardefine:PLATFORM_OS|Yocto}}
    {{#varexists:TOOLCHAIN_TARGET_CROSS_PREFIX | |{{#vardefine:TOOLCHAIN_TARGET_CROSS_PREFIX|{{#var:TOOLCHAIN_TYPE}} }} }}
    {{#vardefine:TOOLCHAIN_TARGET_CROSS_PATH|{{#var:TOOLCHAIN_HOST_SYSROOT_LOCATION}}/usr/bin/{{#var:TOOLCHAIN_TARGET_CROSS_PREFIX}} }}
    {{#vardefine:TOOLCHAIN_TARGET_SYSROOT_PATH|{{#var:TOOLCHAIN_TARGET_SYSROOT_LOCATION}} }} <!-- Default to Yocto
--> {{#varexists:DEBIAN_NAME |
    {{#vardefine:PLATFORM_OS|Debian}}
    {{#vardefine:TOOLCHAIN_TARGET_CROSS_PREFIX | {{#sub:{{#var:CROSS_COMPILE}}|0|{{#expr:{{#Len:{{#var:CROSS_COMPILE}}}}-1}}}} }}
    {{#vardefine:TOOLCHAIN_TARGET_CROSS_PATH|/home/user/{{#var:BUILD_FOLDER_NAME}}/toolchain/{{#var:TOOLCHAIN}}/bin }}
    {{#vardefine:TOOLCHAIN_TARGET_SYSROOT_PATH|/home/user/{{#var:BUILD_FOLDER_NAME}}/rootfs}} }} <!-- Debian
--> {{PageHeader|{{#var:HARDWARE_NAME}} - {{#var:PLATFORM_OS}} QT5 Toolchain Installation}} {{DocImage|category1={{#var:PLATFORM_OS}}|category2={{#var:HARDWARE_NAME}}}} __toc__


= QtCreator installation =
= QtCreator installation =
Before installing QT creator, please build and install yocto QT5 SDK according instruction available at {{Varlink2|Yocto QT5 Toolchain installation|{{#var:RELEASE_LINK}}}}.
Before installing Qt creator, please build and install yocto Qt5 SDK according instruction available at {{Varlink2|Yocto QT5 Toolchain installation|{{#var:RELEASE_LINK}}}}.


Please note that for each QT5 version a minimum Qt Creator version is required
Please note that for each Qt5 version a minimum Qt Creator version is required


{| class="wikitable"
{| class="wikitable"
|-
|-
! scope="col" | Yocto<br/>
! scope="col" | Yocto<br/>
! scope="col" | QT5<br/>
! scope="col" | Qt5<br/>
! scope="col" | QtCreator<br/>
! scope="col" | QtCreator (minimum suggested version)<br/>
|-
|-
| style="padding: 5px;"| Fido
| style="padding: 5px;"| Fido
Line 30: Line 41:
| style="padding: 5px;"| 5.7
| style="padding: 5px;"| 5.7
| style="padding: 5px;"| 3.5.1
| style="padding: 5px;"| 3.5.1
|-
| style="padding: 5px;"| Pyro
| style="padding: 5px;"| 5.8
| style="padding: 5px;"| 3.5.1
|-
| style="padding: 5px;"| Rocko
| style="padding: 5px;"| 5.9
| style="padding: 5px;"| 4.5.2
|-
| style="padding: 5px;"| Sumo
| style="padding: 5px;"| 5.10
| style="padding: 5px;"| 4.5.2
|-
| style="padding: 5px;"| Thud
| style="padding: 5px;"| 5.11
| style="padding: 5px;"| 4.5.2
|-
| style="padding: 5px;"| Zeus
| style="padding: 5px;"| 5.13
| style="padding: 5px;"| 4.5.2
|-
| style="padding: 5px;"| Dunfell
| style="padding: 5px;"| 5.14
| style="padding: 5px;"| 4.5.2
|-
|-
|}
|}


An Ubuntu 16.04 LTS host PC can satisfy this requirement: bundled QtCreator version is 3.5.1.
An Ubuntu 16.04 LTS host PC can satisfy this requirement up to Pyro: bundled QtCreator version is 3.5.1.
 
For previous Ubuntu versions the [https://launchpad.net/~ubuntu-sdk-team Ubuntu SDK team] periodically provide QtCreator backporting for LTS releases and currently provide version 4.1.0, enough up to Yocto Pyro.
 
For Ubuntu 16.04, from Yocto Rocko on, official QtCreator is required.
 
For Ubuntu 18.04 and newer, the stock QtCreator from Ubuntu repositories should be enough.


For previous Ubuntu versions the [https://launchpad.net/~ubuntu-sdk-team Ubuntu SDK team] periodically provide QtCreator backporting for LTS releases and currently provide version 4.1.0.
== QtCreator installation from 'Ubuntu SDK team' repositories (for Ubuntu 16.04 and older) ==


If you have the old SDK installed, the default QtCreator from the archive will be replaced with a more recent version. However apt refuses to automatically remove the packages from the archive, so that is something that needs to be done manually, best before the upgrade:
If you have the old SDK installed, the default QtCreator from the archive will be replaced with a more recent version. However apt refuses to automatically remove the packages from the archive, so that is something that needs to be done manually, best before the upgrade:


  sudo apt-get remove qtcreator qtcreator-plugin*
  sudo apt-get remove qtcreator qtcreator-plugin*
Sometimes the settings of QtCreator (the Qt application of the Ubuntu SDK IDE) break when switching back and forth between different version. When you see broken or ghost Kits, or possible misconfigured devices, or in general anything what is weird it is possible that pushing  the reset button on Qtcreator helps. Note, that it is a rather radical fix. It can be easily done with a single command:
rm -rf ~/.config/QtProject/qtcreator ~/.config/QtProject/QtC*


Next step is to add the ppa and get the package installed.
Next step is to add the ppa and get the package installed.
Line 48: Line 93:
  sudo apt-get install ubuntu-sdk-ide
  sudo apt-get install ubuntu-sdk-ide


After that please logout and login to make the new user group (created by the installation) known to the login session.
The LXD install process should take care of configuring the necessary group membership, but sometimes it fails. Make sure the current user is part of the lxd group ruinning this command:
 
sudo useradd -G lxd `whoami`
 
After that '''please logout and login''' to make the new user group (created by the installation) known to the login session.


The IDE is now be fully usable. It will discover the containers just as it used to do with the click chroots. From all aspects, the developer experience will not change much. Please keep in mind we are still beta testing so there will be most likely some bugs, either with the container images or with the IDE itself. Please report them to the official ubuntu-sdk-ide project in launchpad: https://bugs.launchpad.net/ubuntu-sdk-ide
The IDE is now be fully usable. It will discover the containers just as it used to do with the click chroots. From all aspects, the developer experience will not change much. Please keep in mind we are still beta testing so there will be most likely some bugs, either with the container images or with the IDE itself. Please report them to the official ubuntu-sdk-ide project in launchpad: https://bugs.launchpad.net/ubuntu-sdk-ide


== Ubuntu SDK IDE known issues and troubleshooting ==
=== Ubuntu SDK IDE known issues and troubleshooting ===
 
==== Container backend is not completely initialized ====
 
Mark the small checkbox underneath that said "do not ask again" and then select No.
 
It will probably complain and fail, but should in any case complete the container initialization.


=== The lxd group membership ===
Finally relaunch Qt creator.


Normally the LXD install process takes care of configuring the necessary group membership. But if it does not then we have to make sure the current user is part of the lxd group issue this command:
== QtCreator installation from Qt official repositories (for Ubuntu 16.04 and older) ==


sudo useradd -G lxd `whoami`
From Rocko on, you can download and install a suitable version of QtCreator from


After that please relogin to make the new group known to the login session.
  wget http://download.qt.io/official_releases/qtcreator/4.5/4.5.2/qt-creator-opensource-linux-x86_64-4.5.2.run
  chmod +x qt-creator-opensource-linux-x86_64-4.5.2.run
  ./qt-creator-opensource-linux-x86_64-4.5.2.run


=== Reset QtCreator settings ===
== QtCreator installation from Ubuntu official repositories (for Ubuntu 18.04 and newer) ==


Sometimes the settings of QtCreator (the Qt application of the Ubuntu SDK IDE) break when switching back and forth between different version. When you see broken or ghost Kits, or possible misconfigured devices, or in general anything what is weird it is possible that pushing  the reset button on Qtcreator helps. Note, that it is a rather radical fix. It can be easily done with a single command:
For Ubuntu 18.04 and newer you can safely install QtCreator from Ubuntu repositories:


rm ~/.config/QtProject/qtcreator ~/.config/QtProject/QtC*
  sudo apt install qtcreator


= QtCreator configuration =
= QtCreator configuration =


To configure QtCreator, the environment must be confgured according QT5 toolchain settings:
To configure QtCreator, the environment must be confgured according Qt5 toolchain settings:


  source {{#var:TOOLCHAIN_LOCATION}}
  source {{#var:TOOLCHAIN_LOCATION}}
Line 92: Line 149:
* Press Add  
* Press Add  
* Specify a name (e.g. mydevice GDB)  
* Specify a name (e.g. mydevice GDB)  
* Specify the path: {{#var:TOOLCHAIN_HOST_SYSROOT_LOCATION}}/usr/bin/{{#var:TOOLCHAIN_TYPE}}/{{#var:TOOLCHAIN_TYPE}}-gdb  
* Specify the path: {{#var:TOOLCHAIN_TARGET_CROSS_PATH}}/{{#var:TOOLCHAIN_TARGET_CROSS_PREFIX}}-gdb  


== Compiler configuration ==
== GCC Compiler configuration ==


* Go to Tools => Options
* Go to Tools => Options
Line 101: Line 158:
* Press Add  
* Press Add  
* Specify a name (e.g. mydevice GCC)  
* Specify a name (e.g. mydevice GCC)  
* Specify the path: {{#var:TOOLCHAIN_HOST_SYSROOT_LOCATION}}/usr/bin/{{#var:TOOLCHAIN_TYPE}}/{{#var:TOOLCHAIN_TYPE}}-gcc
* Specify the path: {{#var:TOOLCHAIN_TARGET_CROSS_PATH}}/{{#var:TOOLCHAIN_TARGET_CROSS_PREFIX}}-gcc
 
== G++ Compiler configuration (only for QtCreator > 4.1) ==
 
* Go to Tools => Options
* In the left panel, click on Build&Run.
* Click on the Compilers tab
* Press Add
* Specify a name (e.g. mydevice G++)
* Specify the path: {{#var:TOOLCHAIN_TARGET_CROSS_PATH}}/{{#var:TOOLCHAIN_TARGET_CROSS_PREFIX}}-g++


== QT version configuration ==
== CMAKE configuration (only for QtCreator > 4.1) ==


* Go to Tools => Options
* Go to Tools => Options
* In the left panel, click on Build&Run.
* In the left panel, click on Build&Run.
* Click on the QT Version tab  
* Click on the CMake tab  
* Press Add  
* Press Add  
* Specify a name (e.g. mydevice QT 5.x)  
* Specify a name (e.g. mydevice CMake)
* Specify the path: {{#var:TOOLCHAIN_HOST_SYSROOT_LOCATION}}/usr/bin/qt5/qmake
{{#switch:{{#var:PLATFORM_OS}}
|Debian=
* Specify the path: /usr/bin/cmake
|#default=
* Specify the path: {{#var:TOOLCHAIN_HOST_SYSROOT_LOCATION}}/usr/bin/cmake
}}
 
== Qt version configuration ==
 
* Go to Tools => Options
* In the left panel, click on Build&Run.
* Click on the Qt Version tab
* Press Add
* Specify a name (e.g. mydevice Qt 5.x)  
{{#switch:{{#var:PLATFORM_OS}}
|Debian=
* Specify the path: /usr/bin/qmake
|#default=
* Specify the path: {{#var:TOOLCHAIN_HOST_SYSROOT_LOCATION}}/usr/bin/qmake
}}


== Kit configuration ==
== Kit configuration ==
Line 119: Line 204:
* Name: mydevice
* Name: mydevice
* Device: mydevice
* Device: mydevice
* Sysroot: {{#var:TOOLCHAIN_TARGET_SYSROOT_LOCATION}}
* Sysroot: {{#var:TOOLCHAIN_TARGET_SYSROOT_PATH}}
* Compiler: mydevice GCC
* Compiler: mydevice GCC
* Debugger: mydevice GDB
* Debugger: mydevice GDB
* Qt version: mydevice QT 5.x
* Qt version: mydevice Qt 5.x
* Qt mkspec: leave empty or set to linux-oe-g++ if cross-compilation fails
* Qt mkspec: leave empty or set to linux-oe-g++ if cross-compilation fails
==Video Walkthrough==
The following video demonstrates this process for the DART-MX8M. In general, the process is similar for all Variscite SoMs and versions of Qt Creator:
<youtube width="520" height="330">dM7EegKqxAQ</youtube>


= Application deploying =
= Application deploying =
Line 129: Line 220:
When you run the application, Qt Creator copies the necessary files to the device and starts the application on it.
When you run the application, Qt Creator copies the necessary files to the device and starts the application on it.


In your .pro file, remember to add the following lines to allow QT creator knowing where executable will be deployed:
In your .pro file, remember to add the following lines to allow Qt creator knowing where executable will be deployed:


  target.path = /home/root
  target.path = /home/root
Line 143: Line 234:
* Click on the Run button of your kit in the just opened window
* Click on the Run button of your kit in the just opened window
* Scroll down till the the "Run environment" section
* Scroll down till the the "Run environment" section
* Click on details and add the required environment variables.<br>For framebuffer, set QT_QPA_PLATFORM to linuxfb
* Click on details and add the required environment variables.
** For accelerated framebuffer, set QT_QPA_PLATFORM to eglfs
** For standard framebuffer, set QT_QPA_PLATFORM to linuxfb
** For accelerated wayland, set QT_QPA_PLATFORM to wayland-egl
** For standard wayland, set QT_QPA_PLATFORM to wayland
 
If your build uses the wayland or wayland-egl backend, you must also set XDG_RUNTIME_DIR to /run/user/0


== Debugging problems ==
== Debugging problems ==

Latest revision as of 13:32, 31 October 2023

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release RELEASE_MORTY_V1.0_DART-6UL.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release


DART-6UL - Yocto QT5 Toolchain Installation

QtCreator installation

Before installing Qt creator, please build and install yocto Qt5 SDK according instruction available at Yocto QT5 Toolchain installation.

Please note that for each Qt5 version a minimum Qt Creator version is required

Yocto
Qt5
QtCreator (minimum suggested version)
Fido 5.4 3.3.1
Jethro 5.5 3.3.1
Krogoth 5.6 3.5.1
Morty 5.7 3.5.1
Pyro 5.8 3.5.1
Rocko 5.9 4.5.2
Sumo 5.10 4.5.2
Thud 5.11 4.5.2
Zeus 5.13 4.5.2
Dunfell 5.14 4.5.2

An Ubuntu 16.04 LTS host PC can satisfy this requirement up to Pyro: bundled QtCreator version is 3.5.1.

For previous Ubuntu versions the Ubuntu SDK team periodically provide QtCreator backporting for LTS releases and currently provide version 4.1.0, enough up to Yocto Pyro.

For Ubuntu 16.04, from Yocto Rocko on, official QtCreator is required.

For Ubuntu 18.04 and newer, the stock QtCreator from Ubuntu repositories should be enough.

QtCreator installation from 'Ubuntu SDK team' repositories (for Ubuntu 16.04 and older)

If you have the old SDK installed, the default QtCreator from the archive will be replaced with a more recent version. However apt refuses to automatically remove the packages from the archive, so that is something that needs to be done manually, best before the upgrade:

sudo apt-get remove qtcreator qtcreator-plugin*

Sometimes the settings of QtCreator (the Qt application of the Ubuntu SDK IDE) break when switching back and forth between different version. When you see broken or ghost Kits, or possible misconfigured devices, or in general anything what is weird it is possible that pushing the reset button on Qtcreator helps. Note, that it is a rather radical fix. It can be easily done with a single command:

rm -rf ~/.config/QtProject/qtcreator ~/.config/QtProject/QtC*

Next step is to add the ppa and get the package installed.

sudo add-apt-repository ppa:ubuntu-sdk-team/ppa
sudo apt-get update 
sudo apt-get upgrade
sudo apt-get install ubuntu-sdk-ide

The LXD install process should take care of configuring the necessary group membership, but sometimes it fails. Make sure the current user is part of the lxd group ruinning this command:

sudo useradd -G lxd `whoami`

After that please logout and login to make the new user group (created by the installation) known to the login session.

The IDE is now be fully usable. It will discover the containers just as it used to do with the click chroots. From all aspects, the developer experience will not change much. Please keep in mind we are still beta testing so there will be most likely some bugs, either with the container images or with the IDE itself. Please report them to the official ubuntu-sdk-ide project in launchpad: https://bugs.launchpad.net/ubuntu-sdk-ide

Ubuntu SDK IDE known issues and troubleshooting

Container backend is not completely initialized

Mark the small checkbox underneath that said "do not ask again" and then select No.

It will probably complain and fail, but should in any case complete the container initialization.

Finally relaunch Qt creator.

QtCreator installation from Qt official repositories (for Ubuntu 16.04 and older)

From Rocko on, you can download and install a suitable version of QtCreator from

 wget http://download.qt.io/official_releases/qtcreator/4.5/4.5.2/qt-creator-opensource-linux-x86_64-4.5.2.run
 chmod +x qt-creator-opensource-linux-x86_64-4.5.2.run
 ./qt-creator-opensource-linux-x86_64-4.5.2.run

QtCreator installation from Ubuntu official repositories (for Ubuntu 18.04 and newer)

For Ubuntu 18.04 and newer you can safely install QtCreator from Ubuntu repositories:

 sudo apt install qtcreator

QtCreator configuration

To configure QtCreator, the environment must be confgured according Qt5 toolchain settings:

source /opt/fslc-x11/2.2.1/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi
qtcreator

Device configuration

  • Go to Tools => Options.
  • In the left panel, click on Devices
  • Add a new device representing the target "mydevice":
  • Press Add and choose Generic Linux Device
  • Specify a name (e.g. mydevice)
  • Fill in the device's IP address.
    Please consider using fixed IP adresses: DHCP server lease timeout could lead to unreachable devices.
  • Authentication on our modules by default: Password, User "root", empty password

Debugger configuration

  • Go to Tools => Options
  • In the left panel, click on Build&Run.
  • Click on the Debuggers tab
  • Press Add
  • Specify a name (e.g. mydevice GDB)
  • Specify the path: /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-gdb

GCC Compiler configuration

  • Go to Tools => Options
  • In the left panel, click on Build&Run.
  • Click on the Compilers tab
  • Press Add
  • Specify a name (e.g. mydevice GCC)
  • Specify the path: /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-gcc

G++ Compiler configuration (only for QtCreator > 4.1)

  • Go to Tools => Options
  • In the left panel, click on Build&Run.
  • Click on the Compilers tab
  • Press Add
  • Specify a name (e.g. mydevice G++)
  • Specify the path: /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-g++

CMAKE configuration (only for QtCreator > 4.1)

  • Go to Tools => Options
  • In the left panel, click on Build&Run.
  • Click on the CMake tab
  • Press Add
  • Specify a name (e.g. mydevice CMake)
  • Specify the path: /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/cmake

Qt version configuration

  • Go to Tools => Options
  • In the left panel, click on Build&Run.
  • Click on the Qt Version tab
  • Press Add
  • Specify a name (e.g. mydevice Qt 5.x)
  • Specify the path: /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/qmake

Kit configuration

  • Go to Tools => Options
  • In the left panel, click on Build & Run.
  • Click on the Kits tab
  • Press Add
  • Name: mydevice
  • Device: mydevice
  • Sysroot: /opt/fslc-x11/2.2.1/sysroot/armv7at2hf-neon-fslc-linux-gnueabi
  • Compiler: mydevice GCC
  • Debugger: mydevice GDB
  • Qt version: mydevice Qt 5.x
  • Qt mkspec: leave empty or set to linux-oe-g++ if cross-compilation fails

Video Walkthrough

The following video demonstrates this process for the DART-MX8M. In general, the process is similar for all Variscite SoMs and versions of Qt Creator:

Application deploying

When you run the application, Qt Creator copies the necessary files to the device and starts the application on it.

In your .pro file, remember to add the following lines to allow Qt creator knowing where executable will be deployed:

target.path = /home/root
INSTALLS += target

QT_QPA_PLATFORM configuration

By default, QT_QPA_PLATFORM is set to xcb => X11 backend.

If your build use a different backend, this environment variable must be set before running the binary.

  • In the left panel, click on Projects
  • Click on the Run button of your kit in the just opened window
  • Scroll down till the the "Run environment" section
  • Click on details and add the required environment variables.
    • For accelerated framebuffer, set QT_QPA_PLATFORM to eglfs
    • For standard framebuffer, set QT_QPA_PLATFORM to linuxfb
    • For accelerated wayland, set QT_QPA_PLATFORM to wayland-egl
    • For standard wayland, set QT_QPA_PLATFORM to wayland

If your build uses the wayland or wayland-egl backend, you must also set XDG_RUNTIME_DIR to /run/user/0

Debugging problems

In case you experience debugging problems with messages as "Debugging has failed", please try the following steps:

  • Go to Tools => Options
  • In the left panel, click on Build&Run.
  • Click on the Debuggers tab
  • Press Add
  • Specify a name (e.g. Multiarch GDB)
  • Specify the path: /usr/bin/gdb-multiarch
  • Click on the Kits tab
  • Select your device tab
  • Update the debugger with the new one.

If the file /usr/bin/gdb-multiarch is missing, you can install it running

sudo apt-get install gdb-multiarch