Configuring QtCreator to use the SDK¶
After the installation of the SDK and the sourcing of its environment, there are a couple of steps needed to integrate the QtCreator IDE with the SDK. This document will guide you with the configuration of QtCreator for a remote target using a different architecture than your development machine and also help you getting started with the compilation and remote execution of a simple service.
Warning
All of the commands in this page (including QtCreator) shall be ran in a shell with the SDK environment sourced. It is then advised to keep a terminal window open with the environment set up all along this tutorial. We will refer to this terminal as "an SDK terminal".
Opening QtCreator¶
Always start QtCreator from a shell with the environment of the SDK using:
$ qtcreator
Configuring a target (only done once)¶
QtCreator can automatically deploy and run services onto your PELUX target using sftp. In order to do that, you first need to create a device configuration.
Open the
Tools->Options
window and go to theDevices
tabClick the
Add
button on the right side of the windowChoose
Generic Linux Device
in the window that opens and clickStart Wizard
Choose a
name to identify this configuration
such as "PELUX Raspberry Pi
" for instanceEnter the IP address of your PELUX machine in the next field
Use
root
as usernameChoose Password authentication
Let the password field empty
You should not need to touch the private key path
After having filled in this pane, click Next >
and Finish
. QtCreator will try
to connect over SSH to your PELUX machine. If your machine is reachable, that test should
show the version of the kernel you are using on PELUX.
Adding a new kit (only done once)¶
QtCreator can use a cross-compilation toolchain like the one provided in the PELUX SDK to compile software for an architecture different from the one it is running on. Configuring the entire toolchain takes a bit of time but only has to be done once.
Open the
Tools->Options
window and go to theBuild & Run
tab
Compilers¶

Select the
Compilers
tab- Click the
Add
button on the right and go to GCC -> C In the bottom part of the window, name your C Compiler with something like GCC PELUX Raspberry Pi
For the path of the compiler, use the results of the
which echo ${CC} | awk '{print $1}'
command ran in an SDK terminal
- Click the
- Click the
Add
button and go to GCC -> C++ In the bottom part of the window, name your C++ Compiler with something like G++ PELUX Raspberry Pi
For the path of the compiler, use the result of the
which echo ${CXX} | awk '{print $1}'
command ran in an SDK terminal
- Click the
Debugger¶

Select the
Debuggers
tabClick the
Add
button on the rightIn the bottom part of the window, name your Debugger with something like GDB PELUX Raspberry Pi
For the path of the debugger, use the result of the
which $GDB
command ran in an SDK terminal
CMake¶

Select the
CMake
tabClick the
Add
button on the rightIn the bottom part of the window, name your CMake with something like CMake PELUX Raspberry Pi
For the path of the debugger, use the result of the
which cmake
command ran in an SDK terminal
Qt (optional)¶
This part can be skipped if you are not working with qmake or with a UI component. However, if you want to be able to use Qt:
Select the
Qt Versions
tabClick the
Add...
button on the rightIn the window that opens, select the qmake whose path is the result of the
which qmake
command ran in an SDK terminalIn the bottom part of the window, name your Qt version with something like Qt 5.10.1 PELUX Raspberry Pi
Kit¶

Select the
Kits
tab and click theAdd
button.Name your new kit with something like "PELUX Raspberry Pi"
As
Device type
chooseGeneric Linux Device
As
Device
choose the target you defined earlierFor
Sysroot
, use theBrowse...
button and select the folder whose path is the result of theecho ${SDKTARGETSYSROOT}
command ran in an SDK terminalChoose the previously defined PELUX C and C++ compilers from the corresponding combo boxes
- Change the environment of this kit to the result of the
env
command ran in an SDK terminal If
CC
andCXX
have default compiler flags, those should be added inCFLAGS
andCXXFLAGS
To replaceCFLAGS
andCXXFLAGS
, use the result of the below commands ran in an SDK terminalecho $CC | awk -v c="$CFLAGS" '{first = $1; $1 = ""; print "CFLAGS="$0, c;}'
echo $CXX | awk -v c="$CXXFLAGS" '{first = $1; $1 = ""; print "CXXFLAGS="$0, c;}'
- Change the environment of this kit to the result of the
Choose the previously defined debugger from the corresponding combo box
Choose the previously defined CMake from the corresponding combo box
Change the
CMake Configuration
to add aCMAKE_SYSROOT:STRING=<sysroot path>
line with<sysroot path>
replaced by the actual sysroot path (result ofecho ${SDKTARGETSYSROOT}
)
Click OK and you should now have your Kit ready for development!
How to open the template service project with QtCreator¶
Open QtCreator from an SDK terminal
From the
File
menu chooseNew File or Project

Select
Import Project
from theProjects
sectionClick
Git Clone
and then click theChoose
button

In the window, which just opened, add the repository to the
Repository section
. The git repo for thetemplate-service
is https://github.com/Pelagicore/template-serviceSelect a proper path and add it to the
Path
section, then clickNext
QtCreator will clone the project, then click
Finish
Here you should select the kit to use to build project
Select the kit you have already created in the previous step and click
Configure
You can now compile and deploy to your target using the green arrow on the left of your screen
You can also remotely debug your program using the green arrow with a gray insect on the left of your screen. This, however, requires
gdbserver
which is installed by default incore-image-pelux-*-dev
images