Qt Cross Compiling on Mac for EGLFS on Raspberry Pi - qt

I'm trying to create a Qt application that will run embedded on a Raspberry Pi 3. I followed this guide for cross-compiling and was able to run the example qopenglwidget on the Pi correctly. Now my problem is that I would like to build on my Macbook Pro in Qt Creator, but I have no idea how to now deploy to the device. All the guides I've seen online haven't explained what's actually going on and I have no idea how to build a cross compiler on my Mac. Could anyone point me in the right direction about how to do this?

So you have already compiled an example on your mac that runs on your raspberry pi?
This means you already have a cross compiler.
The guide you linked got a prebuild toolchain from https://github.com/raspberrypi/tools
But I think those are only for ubuntu.
When building Qt you need to specify the toolchain in the configure line:
-device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- \
This is the path to the cross compiler you compile Qt with.
Did this work for you or did you modify this line?
If you want to build a cross compiler yourself you can follow this guide, although I wasn't able to compile Qt with this compiler.
If you have compiled Qt and the examples work on your Pi, you can add a new kit in Qt Creator on your Mac:
Open Qt-Creator -> Preferences:
Under Devices, add a new Generic Linux Device and follow the assistant
Add a new kit, choose a Generic Linux Device as well and specify the device you just added, your compiler you used to build Qt, the debugger if you have built one with you compiler and the Qt Version you compiled.
You should be able to build your project with this kit and it will deploy to your device
Tell us if you were successful.

Related

Self-contained toolchain for Qt for x86 Linux/Windows

I am setting up a Qt project which will be cross-copiled for a given display (running on ARM/Linux). The display will come with a self-contained cross-build toolchain which comprises Qt libraries with a specific Qt version (probably 5.15).
Now I would like to use a specific "static" toolchain incl. Qt libraries to also generate x86-builds of this Qt project (for testing, simulation; building/running on Linux and maybe also on Windows).
I'd avoid using the GCC and Qt development files introduced by the Linux package manager (e.g. apt), because the are not tied to a specific Qt version, i.e. upgrading the OS would always come with the risk to introduce build problems or break compatibility completely.
Are there good-practice approaches to achieve this?
So far I see three options:
Use a docker image
Possible problems:
Finding a image with the correct Qt version
building the Qt application would then work, but to execute it, the compatible Qt LGPL shared libs need to be available to the Qt application binary
Use a x86 -> x86 "standalone" toolchain
Find some standalone x86-toolchain analog to those (x86 -> x86), but additionaly...
it would either have to come with the Qt development files in the correct version
or we would have to build the Qt sources with this toolchain, and then extend the toolchain with the Qt built artifacts
Would be the preferred solution (and currently seems to be the most feasible of the approaches I can think of).
Virtual machine
Possible problems:
Finding a OS version with the correct Qt version
Select a OS version that contains the correct Qt version via package manager.
Not very elegant.
Qt online installer
only provides a limited choice of Qt versions (as of today: 5.15.2, 6.2.4, 6.3.2, 6.4.0) which is probably subject to change in the future

How to install QT on Ubuntu for Cross compiling

I know there are tons of informations out there on the web about my question.
I have searched and tried for at least 2 days to get my setup up and running. But there are many unclear points and i would be very happy if someone could help me with answering my questions.
My situation:
I have an i.MX6 Eval Board on my desk which is running uboot with Linux Kernel 4.9.2. There is no distro on top. Just the kernel with busybox.
Attached to the board is a LCD TFT which is accesed through the Framebuffer. There is no GPU in the Processor.
To compile uboot and the kernel, i use the linaro toolchain gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf This toolchain is located at /opt/toolchain. The compilation of the kernel and uboot works without any problems.
Now i would like to start the application development with QT Creator. I have therefore read a lot of topics on various forums and sites on the web. Unfortunately i did not get it working.
First of all i have a confusion about the meaning of the title: http://doc.qt.io/qt-4.8/qt-embedded-install.html
There is a guide how to install "Installing Qt for Embedded Linux" Does this mean that this version is for an embedded linux, so it means that it has to be installed on the embedded device. Or does it mean that it guides you how to install QT to develop for a target system and install QT on an other system?
Before i wrote this question, i have already installed QT5.7 from their website. After some googling, i figured out that there are some changes in the windowsystem between 4.8 and 5.x. Since i dont have any GPU and therefore i dont have any OpenGL support, im not sure whether i should better go with 4.8 or whether i could use the 5.x version. Usually i tend to use the latest versions if possible.
Next i saw, that i have to define the sysroot directory. In the sysroot directory there have to be the compiled libs for qt for the arm architecture. Is there a precompiled version of these libs or do i have to compile them by my self? If yes, where to start?
EDIT:
In some tutorials they use the angstrom toolchain with a "qte" suffix My linaro toolchain does not have such an suffix. Is it also possible to use my linaro toolchain to build the qt applications?
Maybe you will notice that im new to QT and to the Embedded Linux world.
Anyhow i hope there are people out there who will be happy to share their knowledge about this topic with me.
Thanks.

How to debug/step into QT SDK sources from my project

I want to debug, set break points etc in QT SDK sources,
I have QT5.5.0 built with symbols and symbols are picked up, at lest GDB says so.
But I still cannot debug into for Example QGuiApplication, well I don't really care about QGuiApplication but I want to be able to set break point anywhere in QT Sources and stop there when my code get there.
I do have QT 5.5.0 project opened alongside with my project, but setting break point in QT5.5.0 does not have any effect, also stepping into any QT SDK code simply does nothing, it just stays where it was stopped by breakpoint in my project.
So question is how can I place breakpoints in QT SDK code anywhere I want and when I debug my project I will be able to stop in QT code. And how can I step into QT SDK code.
Ubuntu 14.04, QT 5.5.0, Creator 3.6.0, QNX ( ARM platform ) but it is irrelevant.
Don't install any QT binary (qtcore/qtgui),
build from source and
intall them with debug symbols, should be around 200~300M each library.
Make sure your example code is loading the debug version of qt files.

QT Creator, compiling and deploying a c or c++ to a remote device (BeagleBone or R pi)

I'm trying since days to write and develop programs on my host pc (Ubuntu 64bit) using qt-creator for my beaglebone and raspberry pi devices.
I looked for 'qt-creator cross compile beagle, raspberry etc...' and it leads me to hundred of links and tutorial on how to compile qt-creator for my target plattform. But seriously, that not my idea. All what I want is to simply use my pc for developing my programs and lately deploy them to the remote device.
So first of all a noob question: Is something wrong with my idea? Should I really compile the source of qt for beaglebone or raspberry on my pc for writing programs which lately should be run on that devices????
I will not compile qt-creator again for another plattform, so I don't know how to find the right way. A lot of informations on internet are misleading.
So after many hours spend look for the right information I come up with the following procedure:
first I installed a arm-gnu toolchain on my 64bit Ubuntu.
sudo apt-get install build-essential libc6-armhf-cross libc6-dev-armhf-cross binutils-arm-linux-gnueabihf linux-libc-dev-armhf-cross libstdc++6-armhf-cross gcc-4.8-arm-linux-gnueabihf g++-4.8-arm-linux-gnueabihf
then I installed qt-creator from the repository on my Ubuntu:
sudo apt-get install qtcreator
I tried to configure to use qt for compiling my projects using the toolchain for arm (see following pictures)
and here:
but it seems that qt-creator doesn't recognize the new kit when I start a new project:
Now: I m really confused, I could think that the problem is related to qt, but I m not sure, whether the way of thinking, that I can compile on ubuntu 64bit and then run my application on the remote device is right or not.
For this reason it would be nice if you can answer the question above.
UPDATE: What happen if I add a QT-Version in my Kit???
It happens that the gnueabi compiler conflicts with that options and the following problem arises:
I would like to say again that I don't need to use qt-library or something like that on my remote device. I need just to use the qt-IDE as IDE for my projects (mainly c or c++ plain projects)
You need a complete toolchain
A toolchain is just a name for a group of things:
Compiler for the target platform (or cross compiler in your case)
Sysroot: An image of the filesystem in the target platform
A cross compiling qmake
QtCreator and the kit
You are lacking a cross compiling qmake. Please see my answer at this other post.
Furthermore, you need a toolchain for the Pi, and another toolchain for the Beagle.
It looks like before the update in the question, you didn't even have a valid kit, so there was nothing the IDE could do. You need to create a kit, and set Qt Version to None - because whatever Qt version you have installed is not for the ARM target. So, as long as it'll be none, it should work then, assuming that you have installed a full ARM toolchain for the target, including the Linux-specific bits - since you're not building a bare-bones application, but an application that will run on Linux.
When creating a new project, make sure to select Non-Qt Project, either C or C++, and choose the CMake build system (not qmake or qbs).
To test this out, start with creating a kit for your host platform, without selecting a Qt version (set it to None), and make sure you can create a simple C project and build it (choose proper compilers etc). Once you have done that, you should have an idea how to proceed with building for your ARM Linux targets. It really shouldn't be problematic at all (it all "just works" in my experience), so you probably didn't install something major (related to the target toolchain, nothing to do with Qt nor Qt Creator).
In Derek Molloy's tutorial for the Beaglebone on this subject, he mentions at around minute 18 that installing QT directly through the command sudo apt-get install qtcreator, won't install all the features of the QT app.
Try downloading QT directly from Qt site.

Cross compile qt application for Rasperry Pi

I want to build an example from the QT5 folder for my raspberry pi. I have a working cross compiler and qt5.0.2 installed on my ubuntu. Is this enough to build an application for my device? Do I have to provide any specific qt embedded libs?
For example do I have to take the QT libs from my embedded linux for the applicaiotn on the host to build?
edit:
as mentioned here (http://qt-project.org/wiki/RaspberryPi_Beginners_guide) it says:
"Then go to the “Rasperry Pi” kit tab->System Environment and add LD_LIBRARY_PATH which is set to /usr/local/qt5pi/lib"
This is a qt version build for the PI. So yes I guess I need some specific QT libs which are build for my PI device. The question is now do I have to rebuild these on my own or can I get these from my device directly?

Resources