Cross Compile with SDK and setup QtCreator
Setup the environment to make development with QtCreator easier.
Get and install the SDK
Download the SDK from Releases section of this project.
Create a directory for the SDK where you will download and install the SDK.
mkdir toolchain
cd toolchain
Once you have downloaded the SDK, unpack it in your newly created toolchain folder.
Install the SDK
Still inside the toolchain
folder. Run the following commands to install the SDK.
chmod +x oecore-x86_64-i586-toolchain-nodistro.0.sh
./oecore-x86_64-i586-toolchain-nodistro.0.sh
nemox86 SDK installer version nodistro.0
========================================
Enter target directory for SDK (default: /usr/local/oecore-x86_64): ~/toolchain/
Setting up the environment
You will notice that the SDK has installed environment-setup-i586-oe-linux
file in the directory. This contains all the important environment variables for the SDK. Before the SDK works you need to source the environment. You can do this by adding . ~/toolchain/environment-setup-i586-oe-linux
on the first line of your qtcreator.sh
file or you can source it manually in the terminal and launch qtcreator from that same terminal.
. ~/toolchain/environment-setup-i586-oe-linux
qtcreator &
Now your QtCreator will have the correct environment in use.
Setting up QtCreator
Set up QtCreator to have correct Devices and Kits configured for the Cross Compiling.
Launch qtcreator with the correct environment described above.
Set up Devices
Before setting up devices in QtCreator either launch Nemo Emulator or add physical device
Go to Tools > Options
Go to Devices > Devices
Add device for Generic Linux, Name it for example Root Yocto Emulator
, give it IP 127.0.0.1
and username root
(leave password empty). Connection will fail. Now add SSH port 5555
.
Add another Generic Linux Device but name it for example Nemo Yocto Emulator
, give it IP 127.0.0.1
and username nemo
(leave password empty). Connection will fail. Now add SSH port 5555
.
Now that the Devices are set up we need to set up Kits for the Devices
Set up Kits
Go to Tools > Options
Choose Kits
submenu and select tab Qt Versions
Press Add. Browse and select <sdk>/sysroots/x86_64-oesdk-linux/usr/bin/qmake
. Name it for example as Yocto Emulator Qt
Select the Compilers
tab.
Press Add > GCC > C. Browse and select <sdk>/sysroots/x86_64-oesdk-linux/usr/bin/i586-oe-linux/i586-oe-linux-gcc
. Name it as Yocto Emulator C
.
Press Add > GCC > C++. Browse and select <sdk>/sysroots/x86_64-oesdk-linux/usr/bin/i586-oe-linux/i586-oe-linux-g++
. Name it as Yocto Emulator C++
Select the CMake
tab.
Press Add. Browse and select <sdk>/sysroots/x86_64-oesdk-linux/usr/bin/cmake
. Name it as Yocto Emulator CMake
(Adding debugger is optional.)
Select the Debuggers
tab.
Press Add. Browse and select <sdk>/sysroots/x86_64-oesdk-linux/usr/bin/i586-oe-linux/i586-oe-linux-gdb
. Name it as Yocto Emulator GDB.
Select Kits
tab.
Add new kit
Name as Nemo on Yocto Emulator
Device type: Generic Linux device
Device, use the Nemo Yocto Emulator
you created earlier
Sysroot: <sdk>/sysroots/i586-oe-linux
Compiler: C: Yocto Emulator C
C++: Yocto Emulator C++
Debugger: Yocto Emulator GDB
Qt Version: Yocto Emulator Qt Qt mkspec:
/sysroots//usr/lib/mkspecs/linux-oe-g++ eg. .../sysroots/i586-oe-linux/usr/lib/mkspecs/linux-g++
` (Remember to write down the full path.)
CMake Tool: Yocto Emulator CMake
Press Apply.
Press Clone when the Kit made above is selected.
Name it as Root on Yocto Emulator
and change Device to Root Yocto Emulator
you created earlier.
Congratulations your QtCreator is now setup to cross-compile for the Emulator!
Running the Applications
In short Deploy as Root and Run without deployment as Nemo. When running as Nemo remember to set missing environment variables if any.