Qt on the BeagleBone Black

Install cross-compilation tools as described here.

On Debian PC, install Qt 4 dev tools:

sudo apt-get install qt4-dev-tools gdb-multiarch

Install and build Qt source v4.8 and build it for the BeagleBone:

As user (not root):

Download latest 4.x version of source:

I used:

wget http://download.qt.io/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz

Untar it:

tar -xzf qt-everywhere-opensource-src-4.8.6.tar.gz

Rename the folder to something more convenient:

mv qt-everywhere-opensource-src-4.8.6 qt-4.8.6-beagle

Go to the folder:

cd qt-4.8.6-beagle

Copy the folder:

cp -r mkspecs/linux-arm-gnueabi-g++/ mkspecs/linux-arm-gnueabihf-g++/

Edit the qmake.conf file:

nano mkspecs/linux-arm-gnueabihf-g++/qmake.conf

Change all references of “arm-linux-gnueabi” to “arm-linux-gnueabihf”  (add the “hf”)
For instance, arm-linux-gnueabi-gcc becomes arm-linux-gnueabihf-gcc.
Save the file and exit.

In the root of the new qt directory, create a config script file:

nano config

Add the line:

./configure -v -opensource -confirm-license -xplatform linux-arm-gnueabihf-g++ -embedded arm -little-endian -host-little-endian -prefix /usr/local/qt4.8.6-armhf

Save and exit.

Make it executable:

chmod 700 config

Configure, build, and install:

sudo make install

If you need to re-run config, perhaps to change some options:

make confclean
make clean
sudo make install

Install Qt Creator:

Still as user (not root), download the latest version.  When this was written, it was:

wget http://download.qt.io/official_releases/qt/5.4/5.4.1/qt-opensource-linux-x64-5.4.1.run

Make it executable:

chmod 700 qt-opensource-linux-x64-5.4.1.run

Run it.


On the target BeagleBone, install Debian via the eMMC flasher image:

Then, install basic compilers and Qt4 on the BeagleBone:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install qt4-dev-tools

Create a destination directory on the BeagleBone for the Qt libraries:

sudo mkdir /usr/local/qt4.8.6-armhf

Copy from the PC to the BeagleBone:

On PC (Debian VM):

scp -r /usr/local/qt4.8.6-armhf/* root@beaglebone:/usr/local/qt4.8.6-armhf

When creating new Qt projects, modify PROJECT.pro to look like:

TARGET = ProjectName
 target.files = ProjectName
 target.path = /home/debian/sandbox/ProjectName
 INSTALLS += target

Cross compiling on a Debian VMware machine for the Beaglebone Black

Installed Debian Linux on PC running VMware using image:

Change screen resolution to match system:

Menu: Applications/System Tools/Preferences/System Settings
Click Displays
Change resolution and press Apply

 Add your standard user to the sudoer’s list:

su root

add the following line after the specification for the root user:

username     ALL=(ALL:ALL) ALL

Press <CTRL> O  to save, then <CTRL> X  to exit

The rest of the instructions on this page are to be done as the root user.
Either remain as root user from the above “su root” command, or prepend “sudo ” to every linux command listed below.

 Update system:

apt-get update
apt-get upgrade

Install basic development tools:

apt-get install build-essential

Install cross-compile utilities

nano /etc/apt/sources.list

Add the lines:

deb http://www.emdebian.org/debian unstable main
deb http://ftp.us.debian.org/debian unstable main contrib non-free

Install emdebian key signatures:

apt-get install emdebian-archive-keyring
apt-get update

Install cross compile tools:

apt-get install libc6-armhf-cross libc6-dev-armhf-cross
apt-get install binutils-arm-linux-gnueabihf linux-libc-dev-armhf-cross
apt-get install libstdc++6-armhf-cross
apt-get install gcc-4.7-arm-linux-gnueabihf g++-4.7-arm-linux-gnueabihf

Remove emdebian keyring:

nano /etc/apt/sources.list

Comment out the lines (add # to start of each line):

deb http://www.emdebian.org/debian unstable main
deb http://ftp.us.debian.org/debian unstable main contrib non-free
apt-get remove emdebian-archive-keyring
apt-get update

Make links to executables in /usr/bin:

ln -s /usr/bin/arm-linux-gnueabihf-gcc-4.7 /usr/bin/arm-linux-gnueabihf-gcc
ln -s /usr/bin/arm-linux-gnueabihf-g++-4.7 /usr/bin/arm-linux-gnueabihf-g++