Setup QT creator for developing QT apps on wandboard

From Wandboard Wiki
Jump to: navigation, search
Download and Install QT Creator 3.0

Download QT Creator 3.0:

For 32 bit:

http://download.qt-project.org/official_releases/qtcreator/3.0/3.0.0/qt-creator-opensource-linux-x86-3.0.0.run

For 64 bit:

http://download.qt-project.org/official_releases/qtcreator/3.0/3.0.0/qt-creator-opensource-linux-x86_64-3.0.0.run

Install QT Creator 3.0:

$ sudo chmod +x qt-creator-opensource-linux-x86_64-3.0.0.run
$ ./qt-creator-opensource-linux-x86_64-3.0.0.run

Select the installation directory and follow the guide to complete installation.

Export the qmake variables to QT Creator 3.0

Export the qmake variables to QT Creator 3.0 For a different environment, the path of qmake variables may be different. Please check the correct "qmake variables" in config.summary of qtbase: {Yocto directory}/build/tmp/work/cortexa9hf-vfp-neon-mx6-poky-linux-gnueabi/qtbase/5.1.1- r0/build/config.summary

qmake vars .......... OE_QMAKE_AR = arm-poky-linux-gnueabi-ar OE_QMAKE_CC = arm-poky-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork -mfloat-
abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad OE_QMAKE_CFLAGS =  -O2 -pipe -g
 -feliminate-unused-debug-types OE_QMAKE_COMPILER = arm-poky-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon 
-mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad OE_QMAKE_CXX = arm-poky-linux-gnueabi-g++  
-march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots
/wandboard-quad OE_QMAKE_CXXFLAGS =  -O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden OE_QMAKE_LDFLAGS = -Wl,-O1 
-Wl,--hash-style=gnu -Wl,--as-needed OE_QMAKE_LINK = arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon 
-mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad OE_QMAKE_STRIP = echo styles += mac fusion windows 
QT_CFLAGS_DBUS = -I/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/dbus-1.0 -I/home/pico/workspace/yocto
/yocto_master/build/tmp/sysroots/wandboard-quad/usr/lib/dbus-1.0/include  QT_LIBS_DBUS = -ldbus-1  QT_CFLAGS_PULSEAUDIO = -D_REENTRANT -I/home
/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/glib-2.0 -I/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots
/wandboard-quad/usr/lib/glib-2.0/include  QT_LIBS_PULSEAUDIO = -lpulse-mainloop-glib -lpulse -lglib-2.0  QMAKE_INCDIR_OPENGL_ES2 =  "/home/pico/workspace
/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/libdrm" QMAKE_LIBDIR_OPENGL_ES2 =  QMAKE_LIBS_OPENGL_ES2 =  "-lGLESv2" "-lEGL" "-lGAL"
 QMAKE_INCDIR_LIBUDEV =  QMAKE_LIBS_LIBUDEV = -ludev -lrt  DEFINES += QT_NO_XKB QMAKE_INCDIR_EGL = /home/pico/workspace/yocto/yocto_master/build
/tmp/sysroots/wandboard-quad/usr/include/libdrm  QMAKE_LIBS_EGL = -lEGL  QMAKE_CFLAGS_XCB =  QMAKE_LIBS_XCB = -lxcb-sync -lxcb-xfixes -lxcb-render 
-lxcb-shape -lxcb-randr -lxcb-image -lxcb-shm -lxcb-keysyms -lxcb-icccm -lxcb  PRECOMPILED_DIR = .pch/release-shared OBJECTS_DIR = .obj/release-shared 
MOC_DIR = .moc/release-shared RCC_DIR = .rcc/release-shared UI_DIR = .uic/release-shared sql-drivers =  sql-plugins =  qmake switches ......... 

Enter "/bin" directory under QT Creator 3.0 installed directory.

$ cd ~/qtcreator-3.0.0/bin/

Add qmake variables to qtcreator.sh

bindir=`dirname "$me"`
libdir=`cd "$bindir/../lib" ; pwd`
LD_LIBRARY_PATH=$libdir:$libdir/qtcreator${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
# Add environment variables for wandboard-quad 
export OE_QMAKE_AR="arm-poky-linux-gnueabi-ar"
export OE_QMAKE_CC="arm-poky-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad"
export OE_QMAKE_CFLAGS="-O2 -pipe -g -feliminate-unused-debug-types"
export OE_QMAKE_COMPILER="arm-poky-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad"
export OE_QMAKE_CXX="arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad"
export OE_QMAKE_CXXFLAGS="-O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden"
export OE_QMAKE_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export OE_QMAKE_LINK="arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad"
export OE_QMAKE_STRIP="arm-poky-linux-gnueabi-strip"
export QT_CFLAGS_DBUS="-I/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/dbus-1.0 -I/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/lib/dbus-1.0/include"
export QT_LIBS_DBUS="-ldbus-1"
export QT_CFLAGS_PULSEAUDIO="-D_REENTRANT -I/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/glib-2.0 -I/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/lib/glib-2.0/include"  
export QT_LIBS_PULSEAUDIO="-lpulse-mainloop-glib -lpulse -lglib-2.0"
export QMAKE_INCDIR_OPENGL_ES2="/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/libdrm" 
export QMAKE_LIBDIR_OPENGL_ES2=""  
export QMAKE_LIBS_OPENGL_ES2="-lGLESv2 -lEGL -lGAL" 
export QMAKE_INCDIR_LIBUDEV=""  
export QMAKE_LIBS_LIBUDEV="-ludev -lrt  DEFINES +=" 
export QT_NO_XKB QMAKE_INCDIR_EGL="/home/pico/workspace/yocto/yocto_master/build/tmp/sysroots/wandboard-quad/usr/include/libdrm"
export QMAKE_LIBS_EGL="-lEGL"  
export QMAKE_CFLAGS_XCB=""  
export QMAKE_LIBS_XCB="-lxcb-sync -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb-randr -lxcb-image -lxcb-shm -lxcb-keysyms -lxcb-icccm -lxcb"
# End 
Set up QT Creator for Cross Compiling

Following the guide http://wiki.wandboard.org/index.php/Building_Qt5_using_yocto_on_Wandboard to install poky meta-toolchain.

Activate QT Creator

$ cd ~/qtcreator-3.0.0/bin/
$ sh qtcreator.sh


Select Tools > Options >  Build & Run > Compilers > Add

In the Name column: enter "yocto-arm-gcc"

In the Compiler path column: enter "/opt/poky/1.5+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++"

Click "Apply".

Setup qmake location in QT Creator
Build & Run > Qt Versions > Add

In the qmake location column: Select the path "{Yocto directory}/build/tmp/work/cortexa9hf-vfp-neon-mx6-poky-linux-gnueabi/qtbase/5.1.1-r0/build/bin/qmake"

Click "Apply".

Setup Kits in QT Creator
Select Tools > Options > Build & Run > Kits > Add

In the Name column: enter "i.mx6" . In the Compiler column: select "yocto-arm-gcc"

In the QT version column: select "Qt 5.1.1(build)"

Click "Apply".

Setup QT Creator for Deploying Application on wandboard
Select Tools > Options > Devices > Add
Select device type as "Generic Linux Device"

In the Name column: enter "wandboard"

In the Authentication type column: select "Password"

In the Host name column: enter "IP address on target board"

Your can use command "ifconfig" on wanboard to check the IP.

root@wandboard:~# ifconfig

In the Username column: enter "root"

In the Password column: leave the column blank.

Click "Apply".

Build and Deploy application in QT Creator
Select Tools > Options > Build & Run > Kits 

In the Device type column: select "Generic Linux Device"

In the Device column: select "wandboard"

Click "Apply".