Getting started QT cross-compile to Rpi4
-
Hello, just getting started here, and actually created a program using VS2019 and VisualGDB and cross-compiling onto my Rpi4. I ran into an issue where I was missing the multimedia items, so thought I'd try and setup QT Creator instead of VS2019/VisualGDB and am really struggling. I'm trying to follow the steps in the documentation at link text, but every time I hit Test it fails on the sftp and rsync. I can open a command prompt and ssh into the Rpi with no issues using the same username and I can sftp as well, so I am very confused.
When I run the test this is what I get:
Connecting to host...
Checking kernel version...
Linux 4.19.75-v7l+ armv7lChecking if specified ports are available...
All specified ports are available.Checking whether an SFTP connection can be set up...
Error setting up SFTP connection: File transfer failed: pi@192.168.1.xxx: Permission denied (publickey,password).
Connection closedChecking whether rsync works...
Failed to start rsync: Process failed to start: The system cannot find the file specified.Deployment to this device will not work out of the box.
Device test failed.
What am I doing wrong?
-
Hi and welcome to devnet forum
@MichRX7 said in Getting started QT cross-compile to Rpi4:
Checking whether an SFTP connection can be set up...
Error setting up SFTP connection: File transfer failed: pi@192.168.1.xxx: Permission denied (publickey,password).
Connection closedThere seem to be your problem.
Where (which OS) are you cross-compiling?
-
@koahnig said in Getting started QT cross-compile to Rpi4:
How do you run sftp from creator?
Are you sure that the same environment is used from creator?In Creator, following a blog I found (and an old video on the qt site) I went to tools->options->devices. Here I choose Add and tell it Generic Linux Device. Fill in the form with IP of the PI and username, apply and hit test. It attempts a test to connect to the Pi. It connects, but fails out on the sftp and rsync, so I'm guessing it won't sync files over to the Pi. The output I pasted above is what I get when I hit test.
@koahnig said in Getting started QT cross-compile to Rpi4:
How do you run sftp from creator?
Are you sure that the same environment is used from creator?The output I posted above is the test I run after trying to setup the device in tools->options->devices. It does connect to the Pi during the test if you read the output, but it fails when it tries to use sftp or rsync which I am guessing it uses to transfer the build over to the Rpi to see your program in action.
In windows on the computer that is running QT Creator I am able to open a command prompt and connect to the PI via ssh and sftp, so I don't understand why QT Creator would fail attempting the same. The only thing I can guess is I haven't updated the version of QT that came on the PI Raspbian build. I tried reading some blogs on updating that, but they are very confusing.
-
Ok, so I took a desktop that I had laying around and installed Debian Linux on it. I have now installed QT Creator on that laptop. I tried to follow the directions here to be able to cross-compile on the pi, but everything breaks down right about the time I'm supposed to configure (step 10).
I also tried to use this blog along with the wiki, and again, I get lost right around the configure command.
Does anyone have a "Install this in 5 easy steps for cross-compiling between Linux and Pi" blog I could follow? I can't imagine it is this hard to write gui software for a Rpi.
-
@MichRX7 said in Getting started QT cross-compile to Rpi4:
I can't imagine it is this hard to write gui software for a Rpi.
Cross compilation is not an easy task in general.
Writing GUI apps directly on RPi is as easy as on PC.If you have problems with cross compilation you should say what you did and what was the problem.
-
@jsulm Well, I guess the question is should I just jump on the Pi, open a browser and install QT/Creator on the Pi? I'm more than happy to do that, lol...
But, what I did this time around is I took an unsed PC I had lying around and installed Debian on it, then I opened a browser and installed QT 5.14.1, then I tried to follow the wiki and the blog I reference above, but utilizing the newest version of QT instead of their older version in the posts. Everything seemed to be going well until I hit the compile/make sections of both posts and I start receiving errors.
Here is what I'm entering for the configure:
./configure -release -opengl es2 -device <rpi-version> -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -vHere is what is returned
bash: rpi-version: No such file or directoryI also tried:
./configure -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/opt/raspberry/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /opt/raspberry/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /opt/raspberry/qt5pi -hostprefix /opt/raspberry/qt5pi_host -vHere is the output from that:
- cd qtbase
- /root/raspi/qt-everywhere-src-5.14.1/qtbase/configure -top-level -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/opt/raspberry/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /opt/raspberry/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /opt/raspberry/qt5pi -hostprefix /opt/raspberry/qt5pi_host -v
Creating qmake...
make: Nothing to be done for 'first'.
Command line: -release -opengl es2 -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/opt/raspberry/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /opt/raspberry/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /opt/raspberry/qt5pi -hostprefix /opt/raspberry/qt5pi_host -v
Project ERROR: Cannot run target compiler '/opt/raspberry/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++'. Output:
===================
sh: 1: /opt/raspberry/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++: not found
===================
Maybe you forgot to setup the environment?
So, now I try and figure out where to go from there...
-
@koahnig said in Getting started QT cross-compile to Rpi4:
Possibly a stupid question but did you install the cross-compiler and is it available in the specified location?
No question is stupid, because I am a Linux/qt newbie.
So, if I look on the Linux pc (not the Pi) I do not see anything in /opt/ (aka, no raspberry directory) which I guess answers that. Did I miss a step on installing this?
-
Regardless where you compile you need to install a proper compiler for the RPi.
Therefore, either compiling on Windows or Linux you need a cross-compiler for cross-compiling. If you would compile of RPi directly, you need to have there a proper compiler too. However, you wouldnot call it cross-compiler then.
Typically the guidelines found shall give you some hint on where to find a suitable cross-compiler for your task. Check the RPi user fora for that.
-
@koahnig Thanks for the reply. Would those links I shared be the correct one's? I thought it would build the directories and files for the Pi and the Cross-Compile machine. Obviously I did something wrong, but if I knew they were what I was looking for I'd try again (and again, and again, lol...)
-
This link looks fine to me. https://www.ics.com/blog/configuring-qt-creator-raspberry-pi
No guarantee since I simply checked what is there. If you have follwed this already partly. You have missed to setup the cross-compiler of step 3.
For step 4 I would go for a newer version of Qt. Version 5.7 is a bit dusty already. Maybe checkout Qt5.14.1 or one of Qt5.12.x versions. -
Did you(or anyone else) got it running by now? And if yes, how?
I also always get stuck at step 10 no matter what guide I used (about 9 different ones)
and I would consider myself as not new at linux or/and qt creator.
I got Android cross compiling up and
running but raspberry seems to be a struggle/chellange by itself.