Building Qt

From Texas Instruments Wiki
Jump to: navigation, search




Useful Links

New home for Qt

Qt is now hosted on qt-project.org.

Qt Embedded Download Location

  • You can download the Open Source LGPL version of Qt libraries 4.6.2 for embedded Linux here


TI software Package Download Location

  • DVSDK - Compare the versions of PSP & GFX-SDK on this link against the individual versions below
  • PSP - 03.00.00.04
  • GFX SDK - 03.01.00.06


Getting Started Guides


Qt 4.8, Qt5

Refer to below page for configuration information for Cortex-A8 processors

https://github.com/prabindh/qt-configs

Qt 4.7

  • Using Qt4.7 - Refer to this page for an overview of using QtQuick feature introduced in Qt 4.7


Setting up Target before Qt Build

  • You may use the already built MLO, u-boot, uImage and filesystem under AM35x-OMAP35x-PSP-SDK-xx.xx.xx.xx/images/ or rebuild as per GSG
  • Please follow Graphics SDK GSG for getting started on SGX if you need 3D Graphics (OpenGL ES xx) in you Qt GUI Application and your processor has SGX

     -You may need to refer the Technical Reference Manual of your Processor to determine whether it has SGX or not

FileSystem:

  • Use the PSP file system from AM35x-OMAP35x-PSP-SDK-xx.xx.xx.xx

Code Sourcery Toolchain:

  • Please click here for instructions

Note: For BeagleBoard, please use the same toolchain as the one used to compile your kernel & filesystem
Bootargs:


Building Qt with OpenGL ES accelerated by SGX

  • The Processors listed below has SGX (GPU for 3D Graphics Acceleration). These processors are capable of 3D Graphics using OpenGL ES/OpenVG via SGX.

     - OMAP3515/30

     - DM3715/30

     - AM3517

     - AM3717

  • If you are making your Qt GUI Application using OpenGL ES 1.1/2.0 (3D Graphics), then you need to build Qt with OpenGL ES support. 

Please refer Building_Qt_with_OpenGL_ES_accelerated_by_SGX, which is an article dedicated for this configuration.

  • For Building Qt without OpenGL ES support, follow this procedure



Building Qt 

You can follow these steps to build Qt *without* OpenGL ES support for any ARM based TI Processor.


Step 1:

It is assumed that you have downloaded Qt embedded libraries and have set up the target board as mentioned above in this wiki


Step 2:

Copy the qmake conf for your processor. Replace <NAME_OF_PROCESSOR> with the name of your target in all the steps below:

cp -R [qt-install-dir]/mkspecs/qws/linux-arm-g++/ [qt-install-dir]/mkspecs/qws/linux-<NAME_OF_PROCESSOR>-g++/

Fix/Add qmake.conf under [qt-install-dir]/mkspecs/qws/linux-<NAME_OF_PROCESSOR>-g++/qmake.conf

#
# 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 = Please update this flag with your arm family specific compiler optimization options
QMAKE_CXXFLAGS_RELEASE = Please update this flag with your arm family specific compiler optimization options

QMAKE_CC = arm-none-linux-gnueabi-gcc
QMAKE_CXX = arm-none-linux-gnueabi-g++
QMAKE_LINK = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = arm-none-linux-gnueabi-strip

load(qt_config)

Note: For a different toolchain, please change the qmake.conf above accordingly. e.g For Angstrom Toolchain, you may need to change arm-none-linux-gnueabi-gcc to arm-angstrom-linux-gnueabi-gcc

sample qmake.conf for AM35xx/OMAP35xx (Cortex-A8 family)

#
# 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 = arm-none-linux-gnueabi-gcc
QMAKE_CXX = arm-none-linux-gnueabi-g++
QMAKE_LINK = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = arm-none-linux-gnueabi-strip

load(qt_config)

sample qmake.conf for AM18x (ARM9 family)

#
# 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=armv5te
QMAKE_CXXFLAGS_RELEASE = -O3 -march=armv5te

QMAKE_CC = arm-none-linux-gnueabi-gcc
QMAKE_CXX = arm-none-linux-gnueabi-g++
QMAKE_LINK = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++

# modifications to linux.conf
QMAKE_AR = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = arm-none-linux-gnueabi-strip

load(qt_config)

If you want to add touchscreen support, the Qmake configuration should specify the path to the touchscreen library in QMAKE_INCDIR and QMAKE_LIBDIR.

The sample configurations for ARM9 and Cortex-A8 are available at the links below. Update the path to the touch screen library in the corresponding qmake.conf file


Step 3:

  • The steps below will list all the configure feature options available in Qt. You can add/remove feature using these configure options.
cd [qt-install-dir]

./configure --help 
  • Sample Configure for Qt embedded:
./configure -prefix <PATH> -embedded arm -platform qws/linux-x86-g++ -xplatform qws/linux-omap3-g++ -depths 16,24,32 -no-mmx 
-no-3dnow -no-sse -no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -qt-mouse-pc -qt-mouse-linuxtp 
-qt-mouse-linuxinput -plugin-mouse-linuxtp -plugin-mouse-pc -fast 

Note:

  • "-prefix" <PATH> option in the configure above points to the path inside the rootfs where qt-e will be installedon Target FileSystem
  • '"-platform 'qws/linux-x86-g++" in configure above assumes your host machine CPU to be of 32-bit. For 64-bit, use "-platform qws/linux-x86_64-g++"
  • For TouchScreen, you need to append the configure options "-qt-mouse-tslib" in above mentioned recommended options


Step 4:

> make

> make install

  • You can also use "make install INSTALL_ROOT=<PATH_TO_APPEND_TO_PREFIX_INSTALLPATH_OF_CONFIGURE>" to append path to -prefix

e.g. if the path in "-prefix" option of configure is "-prefix /opt/qt" and you use "make install INSTALL_ROOT=/home/alpha/nfs/", then the qt binaries will be installed at "/home/alpha/nfs/opt/qt"


 Step 5:

Running the Qt Application:

After copying/installing the qt binaries in the target filesystem, you can run the qt examples & qt demos

For the commands below, I have installed my qt-embedded in the path: /opt/qt-embedded

[mailto:root@arago root@arago]:~# export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/opt/qt-embedded/lib 
 root@arago:~# cd /opt/qt-embedded/demos/

root@arago:~# cd composition root@arago:~# ./composition -qws



You can see the output either on the lcd or dvi output depending on how you configured your target board to output




Creating Project in Qt

  • Export the toolchain to be used for cross-compiling
  • Export "qmake" under [qt-install-dir]/bin/qmake
  • cd path/to/project
  • qmake -project
  • qmake -spec qws/linux-<NAME_OF_PROCESSOR>-g++  (From Step 2 of Building Qt above)
  • make


Configuration Examples

Comment: examples below are taken from real-world tests but don't mean you shouldn't consider other options. Especially where modules are not build you might remove that option to get the full Qt functionality (e.g. -no-phonon was used in one case to reduce compile time as we had no need for phonon in our application demo).

Qt 4.5.x Embedded Linux: Configuration for OMAP-L137

./configure -prefix /opt/qt -embedded arm -platform /qws/linux-x86-g++ -xplatform /qws/linux-omapl1-mv-g++ -qt-kbd-usb -depths 16 -no-cups -no-largefile -no-accessibility -no-opengl -no-openssl

Qt 4.5.x WinCE: Configuration for OMAP3

Make sure that your path contains <wince_qt_dir>\bin. Then open a Visual Studio shell and enter:

configure.exe -platform win32-msvc2005 -xplatform wince60standard-armv4i-msvc2005


Here we assume that WinCE Platform Builder and the OMAP3 WinCE BSP are installed. Now type "nmake" inside a Platform Builder build shell to generate Qt DLLs. The DLLs maybe installed into C:/Windows on the WinCE file system or reside in the same folder as the Qt application (e.g. on SD card or USB disk). This is especially useful for testing.

For generating the run-time tree do this:

set INSTALL_ROOT=\some_path


nmake install

This will copy all relevant files into C:\some_path. From there copy to the WinCE target.

Qt 4.5.x Embedded Linux: Configuration for DM365 with Avnet LCD

If using the Avnet LCD kit, some patches need to be applied to the kernel. Follow the instructions on DM365 touchscreen with Qt.

For touchscreen support, ensure the following lines are in the gmake.conf file:

#modifications to include ts-lib
QMAKE_INCDIR            = /home/user/workdir/dm365/usr/include
QMAKE_LIBDIR            = /home/user/workdir/dm365/lib

Add the following lines to the /root/.profile file on the target. This sets the environment variables for touch screen support, and for Qt to use the second OSD window (/dev/fb2).

export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export QWS_DISPLAY=LinuxFb:/dev/fb2

See Also