VAR-SOM-MX6 QT Hello World: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 1: Line 1:
{{PageHeader|VAR-SOM-MX6 - QT Hello World}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__
{{PageHeader|VAR-SOM-MX6 - QT Hello World}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__


A simple cookbook to show how to compile an application with QT.
= Build and install tools =
Will use one of the sample application as example.
$ cd ~/var-som-mx6-yocto-fido/
 
1. Build tools
$ cd ~/var-som-mx6-daisy-v6/
$ . ./setup-environment build_x11
$ . ./setup-environment build_x11
edit local.conf and add to the bottom:
edit local.conf and add to the bottom:
<pre>
#
#
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug eclipse-debug"
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug eclipse-debug"
 
</pre>
Fix a bug due to branch removal in QT git.
Build:
gedit ../sources/meta-qt5/recipes-qt/qt5/qtsystems_git.bb
<pre>
Change:
#QT_MODULE_BRANCH = "5.3"
QT_MODULE_BRANCH = ""
 
$ bitbake meta-toolchain-qt5
$ bitbake meta-toolchain-qt5
 
</pre>
2. install tools
Install:
tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.6.1.sh
<pre>
$ tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.6.1.sh
Keep the default install directory /opt/poky/1.6.1
Keep the default install directory /opt/poky/1.6.1
</pre>


3. sample application
= sample application =
$ cd ~/var-som-mx6-daisy-v6/
<pre>
$ cd ~/var-som-mx6-yocto-fido/
$ mkdir qtapps
$ mkdir qtapps
$ cd qtapps
$ cd qtapps
Line 30: Line 27:
$ cd hellowindow
$ cd hellowindow


$ export PATH=/opt/poky/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
$ export PATH=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
$ export PATH=/opt/poky/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/qt5:$PATH
$ export PATH=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/qt5:$PATH
</pre>


Create new file qmake.conf:
Create new file qmake.conf:

Revision as of 15:34, 13 December 2015

VAR-SOM-MX6 - QT Hello World

Build and install tools

$ cd ~/var-som-mx6-yocto-fido/ $ . ./setup-environment build_x11 edit local.conf and add to the bottom:

#
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug eclipse-debug"

Build:

$ bitbake meta-toolchain-qt5

Install:

$ tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-1.6.1.sh
Keep the default install directory /opt/poky/1.6.1

sample application

$ cd ~/var-som-mx6-yocto-fido/
$ mkdir qtapps
$ cd qtapps
$ cp -a ../build_var/tmp/work/x86_64-linux/qtbase-native/5.2.1-r0/qtbase-opensource-src-5.2.1/examples/opengl/hellowindow ./
$ cd hellowindow

$ export PATH=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
$ export PATH=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/qt5:$PATH

Create new file qmake.conf:

CROSS_COMPILE = arm-poky-linux-gnueabi- ROOTFS = /opt/poky/1.6.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi

QMAKE_CC = $CROSS_COMPILE-gcc QMAKE_CXX = $CROSS_COMPILE-g++ QMAKE_LINK = $CROSS_COMPILE-g++ QMAKE_LINK_SHLIB = $CROSS_COMPILE-g++ QMAKE_AR = $CROSS_COMPILE-ar cr QMAKE_OBJCOPY = $CROSS_COMPILE-objcopy QMAKE_STRIP = $CROSS_COMPILE-strip

QMAKE_LFLAGS_RELEASE = -Wl,-O1,-rpath $ROOTFS/usr/lib

QMAKE_INCDIR = $ROOTFS/usr/include QMAKE_LIBDIR = $ROOTFS/usr/lib QMAKE_INCDIR_X11 = $ROOTFS/usr/include QMAKE_LIBDIR_X11 = $ROOTFS/usr/lib QMAKE_INCDIR_OPENGL = $ROOTFS/usr/include QMAKE_LIBDIR_OPENGL = $ROOTFS/usr/lib


$ qmake edit the genreated Makefile and insert in the top

CROSS_COMPILE = arm-poky-linux-gnueabi ROOTFS = /opt/poky/1.6.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi

OE_QMAKE_CC = $(CROSS_COMPILE)-gcc OE_QMAKE_CXX = $(CROSS_COMPILE)-g++ OE_QMAKE_LINK = $(CROSS_COMPILE)-g++ OE_QMAKE_LINK_SHLIB = $(CROSS_COMPILE)-g++ OE_QMAKE_AR = $(CROSS_COMPILE)-ar cr OE_QMAKE_OBJCOPY = $(CROSS_COMPILE)-objcopy OE_QMAKE_STRIP = $(CROSS_COMPILE)-strip

$ make clean $ make copy the hellowindow to your target and run it export DISPLAY=:0.0 ./hellowindow --platform eglfs