I am developing my QT code under Linux, specifically Ubuntu 10.4. IMHO it is a mistake to develop Qt natively on the Beagleboard except for trivial applications. Although this blog discusses Ubuntu 10.4 as the development environment and Beagle-xM as the target this blog should be valuable when it is applied to other Linux and the original Beagleboard.
I prefer to get Qt-Creator from their website rather than Ubuntu's Software Center because you get the latest version and it is easy to install. Go to
http://qt.nokia.com/downloads to download Qt. Get the latest version of Qt for Linux; be sure to get the appropriate 32bit or 64bit version. [This blog assumes that you are using the 32 bit version.] Once downloaded go to the download directory and execute the following using your download file name:
chmod u+x qt-sdk-linux-x86-opensource-2010.05.1.bin
./qt-sdk-linux-x86-opensource-2010.05.1.bin
Installing the Cross-Compiler:
You will need to install a toolchain that will compile code on your Linux box that is intended to run on the ARM processor on your BeagleBoard. Different arm processors need different compiler options. So the easiest way to do this is to download a pre-configured toolchain for the Embedded OS and processor you are using. Go to the
Angstrom toolchain website and download a toolchain. The ARM Processor on the BeagleBoard-xM is a Texas Instruments DM3730 which uses a ARM 7a Core.
For 32-bit Ubuntu you will want to download this file:
angstrom-2010.4-test-20100422-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2
For 64-bit Ubuntu you will want to download this file:
angstrom-2010.4-test-20100421-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2
Go to the download directory and run:
sudo tar -xvj -C / -f [DownloadFileName]
Building Qt:
Now that you have your cross compiler installed it is time to compile Qt with it. First thing to do is to download the Open Source LGPL version of Qt libraries 4.6.2 for Embedded Linux
here. Remember your download directory, you will need it for the following steps.
First; unzip the tar file you just downloaded. Go into the download directory and execute:
tar -xvzf qt-everywhere-opensource-src-4.6.2.tar.gz
You need to create a new make.conf. Run the following line to make a new mkspecs directory for the BeagleBoard Processor.
cp -R [DownloadDirectory]/mkspecs/qws/linux-arm-g++/ [DownloadDirectory]/mkspecs/qws/linux-DM3730-g++/
Edit the qmake.conf file found in [DownloadDirectory]/mkspecs/qws/linux-DM3730-g++/ to look like the following.
#
# qmake configuration for building with arm-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
#Toolchain
#Compiler Flags to take advantage of the ARM architecture
QMAKE_CFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
QMAKE_CC = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/gcc
QMAKE_CXX = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++
QMAKE_LINK = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++
QMAKE_LINK_SHLIB = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++
# modifications to linux.conf
QMAKE_AR = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/ar cqs
QMAKE_OBJCOPY = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/objcopy
QMAKE_STRIP = /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/strip
load(qt_config)
We are just about ready to compile Qt. You can look at the configuration options before you start by running the following command.
cd [DownloadDirectory]
./configure --help
Now run the configure command [this can take many minutes]:
./configure -opensource -confirm-license -prefix /opt/qt-arm -no-qt3support -embedded arm -little-endian -xplatform qws/linux-DM3730-g++ -qtlibinfix E
See this
website for more details if needed. [Note: If you are using a 64-bit version of the compiler you will need to use "-platform /qws/linux-x86_64-g++" instead of "-platform '/qws/linux-x86-g++" in the above. ]
Once this is complete you can run make and make install [make can take many hours]:
make
make install
Setting Up Qt-Creator
Once make and make install are complete you can add the Arm tools to Qt-Creator. Start Qt-Creator select Tools->Options->Qt4->Qt Versions. Press the + button and fill out the form as show below.
Setting up the BeagleBoard-xM
Now it is time to set up the Beagleboard. All of the Qt files that you need to move to the BeagleBoard can be found in the /opt/qt-arm/lib directory on your Linux Build System.
Unfortunately Qt expects the library and font files to have the same directory structure on your build machine and your target machine. On our systems that directory is /opt/qt-arm/lib because we used "-prefix /opt/qt-arm" in our configuration. So on your Beagleboard you need create the /opt/qt-arm/lib directory.
cd /
mkdir opt
cd opt
mkdir qt-arm
cd qt-arm
mkdir lib
cd lib
Now you need to copy all the files out of your build system's /opt/qt-arm/lib directory and put those into the BeagleBoard-xM's /opt/qt-arm/lib directory. You can get the files to the Beagleboard by either networking, using a usb drive or plug the SD card into your Linux Build System.
You will now need to set up the BeagleBoard's path to point to this library directory. Edit the PATH statement in /etc/profile to the following:
PATH="/opt/qt-arm/lib:.....
There are a few packages you need to install on your BeagleBoard-xM to support Qt.
Connect your BeagleBoard to the Internet.
If you have not updated your opkg mangers library in a while then run:
opkg update
To get the packages run:
opkg install libgles-omap3
opkg install libstdc++6
opkg install libpng12-0
These packages are the ones that I found I needed when running a Qt program that uses the QtCore andQtGUI; other packages may need to be added as your Qt program uses more Qt libraries.
If you are unable to connect the BeagleBoard to Internet you can go
here to download the packages.
Building and Running a Qt Program.
Start Qt-Creator; Create a new project. Go to Projects and make sure your Build Settings is set to QT BeagleBoard 4.6.2. Build your project. Copy your executable to the BeagleBoard and execute it. Normally you will be running the program (if it is a GUI application) using the Frame Buffer and you will need to use the -qws option.
Good Luck! be sure to comment below. As people provide input I will modify this document.