Raspberry Qt – Part 8

Installing Qt on the Raspberry Pi

Once again I will rant about the piecemeal convoluted expert friendly process of installing Qt 5.x. That becomes painfully obvious when you attempt to install on a Pi. Rather than give you a bunch of convoluted instructions I’m simply going to show you the boxes I had checked in Synaptic package manager. If you haven’t already done so on your Pi, you need to install the Synaptic Package Manager.

You need the C++ compiler which isn’t quite the name you expect.

g_pi

Obviously you need QtCreator

qtcreator_pi

QtTools

qttools_pi

QtBase

qtbase_pi

And lots of Qt 5 libraries

libqt5_pi_1

libqt5_pi_2

libqt5_pi_3Once everything installs successfully it is a good idea to reboot before trying anything.

You will find QtCreator under the Programming menu tab of the main menu list. Depending on which Raspbian version you have QtCreator may or may not start from the GUI desktop. The Welcome screen for the IDE had some QML code and QML is a bad thing. If you are on such a version you have to start QtCreator from the command line:

qtcreator -noload Welcome

add_compiler_piAssuming you will just try to open the .pro file of our project, you will probably find a few things incorrectly configured. Most notably QtCreator will complain about your kit. For whatever reason, it cannot find your compiler. Navigate to “Manage Kits” in the IDE and add your compiler. If “should” be in the location I have here, but you can use the Browse button to poke around.

I will also make the grandiose assumption most of you simply clicked the “run” or “debug” green arrows to see what happened. Well, I told you not to rush ahead. Hopefully you opened a terminal window to full screen size on your Pi and typed the following:

sudo tail -f /var/log/syslog

The first attempt probably resulted in a log like this:

Jul 30 15:49:59 raspberrypi LogikalLogger: Result of connecting signal mapper 1
Jul 30 15:49:59 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Sat Jul 30 15:50:29 2016 [try http://www.rsyslog.com/e/2007 ]
Jul 30 15:49:59 raspberrypi LogikalLogger: Testing: ttyAMA0 manufacturer:  description:  serial number:  baud: 9600 data: 8 parity: 0 stop: 1
Jul 30 15:49:59 raspberrypi LogikalLogger: Test failed: Permission denied
Jul 30 15:49:59 raspberrypi LogikalLogger: Attempting to open
Jul 30 15:49:59 raspberrypi LogikalLogger: SerialThread::openSuccessfully   Open failed.  Attempting close and re-open Is a directory
Jul 30 15:49:59 raspberrypi LogikalLogger: SerialThread::openSuccessfully   ReOpen failed.Is a directory
Jul 30 15:49:59 raspberrypi LogikalLogger: SerialThread::nukeServer called

Then you probably quickly poked around on-line remembering I mentioned something called mgetty being a problem. You most likely came across the oft-posted yet really wretched advice which said to “disable the serial port” and gave you instructions of how to do it in the GUI.

disable_serial_port

After you rebooted you ran again experiencing even more nothing. This time your log looked something like this:

Jul 30 15:43:57 raspberrypi LogikalLogger: Attempting to open
Jul 30 15:43:57 raspberrypi LogikalLogger: SerialThread::openSuccessfully   Open failed.  Attempting close and re-open Is a directory
Jul 30 15:43:57 raspberrypi LogikalLogger: SerialThread::openSuccessfully   ReOpen failed.Is a directory
Jul 30 15:43:57 raspberrypi LogikalLogger: SerialThread::nukeServer called

If you paid attention to the log you will notice you no longer saw any mention of serial port devices.

Some of you might have opened a terminal window, navigated to your build directory and ran the executable under sudo. Others might have simply started qtcreator under sudo (always a bad idea.) In either case you noticed, assuming your earlier test from the PC to the Pi worked, this test worked. If you leave it running long enough though you noticed you get some garbage characters every so often.

That would be due to the fact that mgetty on the Raspberry Pi is a bit like that horror movie character “Jason.” No matter how many times you kill him, he keeps coming back. How to properly kill mgetty will be the topic of our next conversation.