Add Yocto SDK with QT5 to QT Creator: Difference between revisions
Pzimmermann (talk | contribs) Commented the section about the environment, because it makes problems with qmake |
Mschmoeller (talk | contribs) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
The following instructions are based on '''DHCOM STM32MP1''' computer on module and Yocto version " | The following instructions are based on '''DHCOM STM32MP1''' computer on module and Yocto version "dunfell" | ||
__TOC__ | __TOC__ | ||
Line 13: | Line 13: | ||
== Download and install the SDK package == | == Download and install the SDK package == | ||
Get the [[media: | Get the [[media:20211026-dhlinux-glibc-x86_64-dh-image-demo-cortexa7t2hf-neon-vfpv4-toolchain-nodistro.0.zip|QT5 SDK for STM32mp1]] | ||
Unpack the archive and install the toolchain. | Unpack the archive and install the toolchain. | ||
Line 50: | Line 50: | ||
[[Image:Qtcreator-add-kit.jpg|850px]] | [[Image:Qtcreator-add-kit.jpg|850px]] | ||
If there is a warning/error shown, please click apply between each step. | |||
There is one last point. The SDK comes with an environment-setup which sets some variables that are needed if you want to use the toolchain. There are two ways to get this environment into Qt Creator: | |||
* The first way is rather simple: Open a shell and source the environment-setup script (in the example <tt>/opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi</tt>). After that start Qt Creator in the same shell session. If you want to use another toolchain, you have start a new shell session, source the corresponding environment-setup and start QtCreator from there. | |||
* The other possible way is bit more complicated, but in return it is possible to change the toolchain without restarting Qt Creator: In the settings of the kit there is a button for setting the environment of this kit ("Change"-button right of "Environment"). When this button is pressed, a window for editing text opens. There you can set environment variables by the schema <variable>=<value>, one variable can be set per line. You cannot simply copy the setup script, because at the script the shell is called and other variables are referenced which isn't supported by Qt Creator. It is also possible that the setup script imports additional scripts from the "environment-setup.d" directory of each sysroot. <br /> So you have to source the setup script and look what variables have been set and write them and their respective values into the window. <br /> If you want to use another toolchain, than you can change the used kit. An example for configuring the environment of a kit is inside the collapsible box. | |||
<div class="toccolours mw-collapsible mw-collapsed" style="overflow:auto;"> | <div class="toccolours mw-collapsible mw-collapsed" style="overflow:auto;"> | ||
<div style="font-weight:bold;"> | <div style="font-weight:bold;">Example for setting the environment variables at the kit</div> | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
/opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi: | /opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi: | ||
Line 122: | Line 123: | ||
done | done | ||
fi</tt> | fi</tt> | ||
There are additional scripts in the "environment-setup.d"-directories of the sysroots which are included at the main setup-script. These scripts have the following content: | |||
/opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/cmake.sh: | /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/environment-setup.d/cmake.sh: | ||
Line 160: | Line 163: | ||
</div></div> | </div></div> | ||
Latest revision as of 13:59, 26 October 2021
The following instructions are based on DHCOM STM32MP1 computer on module and Yocto version "dunfell"
Prepairing your virtual machine
Get the Virtual Machine for Application Development.
Install the following package:
$ sudo apt-get install qtcreator qt5default
Download and install the SDK package
Get the QT5 SDK for STM32mp1
Unpack the archive and install the toolchain.
$ sh ./dhlinux-glibc-x86_64-meta-toolchain-qt5-cortexa7t2hf-neon-vfpv4-toolchain-nodistro.0.sh
Choose the installation directory (default: /opt/dhlinux/nodistro.0/).
The toolchain is now installed to your system.
Configure Qt Creator
Run QT Creator
In Qt Creator go to Tools > Options > Devices and add your Wandboard as a generic linux device.
go to Tools > Options > Build & Run and:
Add a new c++ compiler. Select your compiler: /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-gnueabi/arm-dhlinux-linux-gnueabi-g++
Add a new debugger. Select your debugger: /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/arm-dhlinux-linux-gnueabi/arm-dhlinux-linux-gnueabi-gdb
Add your Qt version by selecting the qmake located in /opt/dhlinux/nodistro.0/sysroots/x86_64-oesdk-linux/usr/bin/qmake
Add a new kit selecting your new Qt5 version and compiler and setting the sysroot to /opt/dhlinux/nodistro.0/sysroots/cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi and leave the Qt mkspec empty. Then select your device
If there is a warning/error shown, please click apply between each step.
There is one last point. The SDK comes with an environment-setup which sets some variables that are needed if you want to use the toolchain. There are two ways to get this environment into Qt Creator:
- The first way is rather simple: Open a shell and source the environment-setup script (in the example /opt/dhlinux/nodistro.0/environment-setup-cortexa7t2hf-neon-vfpv4-dhlinux-linux-gnueabi). After that start Qt Creator in the same shell session. If you want to use another toolchain, you have start a new shell session, source the corresponding environment-setup and start QtCreator from there.
- The other possible way is bit more complicated, but in return it is possible to change the toolchain without restarting Qt Creator: In the settings of the kit there is a button for setting the environment of this kit ("Change"-button right of "Environment"). When this button is pressed, a window for editing text opens. There you can set environment variables by the schema <variable>=<value>, one variable can be set per line. You cannot simply copy the setup script, because at the script the shell is called and other variables are referenced which isn't supported by Qt Creator. It is also possible that the setup script imports additional scripts from the "environment-setup.d" directory of each sysroot.
So you have to source the setup script and look what variables have been set and write them and their respective values into the window.
If you want to use another toolchain, than you can change the used kit. An example for configuring the environment of a kit is inside the collapsible box.