Qt application on ConnectCore 6

Hello,

I am trying to cross-compil a simple Hello-World application for my connectcore 6 using qt Creator.
I follow the digi provided document “Yocto QT Application Development”.
First of all, this tutorial seems to contain an error. The patch code (page 7) make an error when it is applied to the qtcreator.sh script.
I tried to solve this problem by adding manually all environment variable in qtcreator.
Now the qmake command seems to be ok, following is a part of my Makefile generated by qt Creator:

CC = $(OE_QMAKE_CC)
CXX = $(OE_QMAKE_CXX)
DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -pipe $(OE_QMAKE_CFLAGS) -DLINUX=1 -DEGL_API_FB=1 -g -g -Wall -W -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -pipe -pipe $(OE_QMAKE_CFLAGS) -DLINUX=1 -DEGL_API_FB=1 $(OE_QMAKE_CXXFLAGS) -g -g -g -Wall -W -Wall -W -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/linux-g++ -I…/test_Qt -I$(OE_QMAKE_INCDIR_QT)/QtCore -I$(OE_QMAKE_INCDIR_QT)/QtGui -I$(OE_QMAKE_INCDIR_QT) -I. -I. -I…/test_Qt -I.
LINK = $(OE_QMAKE_LINK)
LFLAGS = $(OE_QMAKE_LDFLAGS) -Wl,-rpath-link,$(OE_QMAKE_LIBDIR_QT)
LIBS = $(SUBLIBS) -L$(OE_QMAKE_LIBDIR_QT) -lQtGui -lEGL -lGAL -DLINUX=1 -DEGL_API_FB=1 -lQtCore -lpthread
AR = $(OE_QMAKE_AR) cqs
RANLIB =
QMAKE = /opt/dey/1.6.2/qt/sysroots/x86_64-deysdk-linux/usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = $(OE_QMAKE_STRIP)
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p

####### Output directory

OBJECTS_DIR = ./

####### Files

SOURCES = …/test_Qt/main.cpp
…/test_Qt/mainwindow.cpp moc_mainwindow.cpp
OBJECTS = main.o
mainwindow.o
moc_mainwindow.o
DIST = /opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/common/unix.conf
/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-
[…]
…/test_Qt/test_Qt.pro
QMAKE_TARGET = test_Qt
DESTDIR =
TARGET = test_Qt

first: all
####### Implicit rules

.SUFFIXES: .o .c .cpp .cc .cxx .C

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o “$@” “$<”

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o “$@” “$<”

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o “$@” “$<”

.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o “$@” “$<”

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o “$@” “$<”

####### Build rules

all: Makefile $(TARGET)

$(TARGET): ui_mainwindow.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
{ test -n “$(DESTDIR)” && DESTDIR=“$(DESTDIR)” || DESTDIR=.; } && test $$(gdb --version | sed -e ‘s,[^0-9]+([0-9]).([0-9]).*,\1\2,;q’) -gt 72 && gdb --nx --batch --quiet -ex ‘set confirm off’ -ex “save gdb-index $$DESTDIR” -ex quit ‘$(TARGET)’ && test -f $(TARGET).gdb-index && objcopy --add-section ‘.gdb_index=$(TARGET).gdb-index’ --set-section-flags ‘.gdb_index=readonly’ ‘$(TARGET)’ ‘$(TARGET)’ && rm -f $(TARGET).gdb-index || true

Makefile: …/test_Qt/test_Qt.pro /opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/linux-g++/qmake.conf /opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/common/unix.conf
/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/common/linux.conf \

[…]

$(QMAKE) -spec /opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile ../test_Qt/test_Qt.pro

/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/common/unix.conf:
/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/common/linux.conf:

[…]

/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/lib/libQtGui.prl:
/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -spec /opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile …/test_Qt/test_Qt.pro

dist:
@$(CHK_DIR_EXISTS) .tmp/test_Qt1.0.0 || $(MKDIR) .tmp/test_Qt1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/test_Qt1.0.0/ && $(COPY_FILE) --parents …/test_Qt/mainwindow.h .tmp/test_Qt1.0.0/ && $(COPY_FILE) --parents …/test_Qt/main.cpp …/test_Qt/mainwindow.cpp .tmp/test_Qt1.0.0/ && $(COPY_FILE) --parents …/test_Qt/mainwindow.ui .tmp/test_Qt1.0.0/ && (cd dirname .tmp/test_Qt1.0.0 && $(TAR) test_Qt1.0.0.tar test_Qt1.0.0 && $(COMPRESS) test_Qt1.0.0.tar) && $(MOVE) dirname .tmp/test_Qt1.0.0/test_Qt1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/test_Qt1.0.0

clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core

####### Sub-libraries

distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile

check: first

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_moc_header_make_all: moc_mainwindow.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mainwindow.cpp
moc_mainwindow.cpp: …/test_Qt/mainwindow.h
$(OE_QMAKE_MOC) $(DEFINES) $(INCPATH) …/test_Qt/mainwindow.h -o moc_mainwindow.cpp

compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h
ui_mainwindow.h: …/test_Qt/mainwindow.ui
$(OE_QMAKE_UIC) …/test_Qt/mainwindow.ui -o ui_mainwindow.h

A problem still there when i tried to compile my simple application. I cannot find it out, because the error message is not really explicit.

16:10:58: Exécution des étapes pour le projet test_Qt…
16:10:58: Débute : “/opt/dey/1.6.2/qt/sysroots/x86_64-deysdk-linux/usr/bin/qmake” /home/belem/Qt/test_Qt/test_Qt.pro -r -spec linux-gnueabi-oe-g++ CONFIG+=debug
16:10:58: Le processus “/opt/dey/1.6.2/qt/sysroots/x86_64-deysdk-linux/usr/bin/qmake” s’est terminé normalement.
16:10:58: Débute : “/usr/bin/make” ARCH=arm CROSS_COMPILE=/opt/dey/1.6.2/graphical/sysroots/x86_64-deysdk-linux/usr/bin/arm-dey-linux-gnueabi/arm-dey-linux-gnueabi-g++
XX -c -pipe -pipe -pipe “FLAGS” -DLINUX=1 -DEGL_API_FB=1 “XXFLAGS” -g -g -g -Wall -W -Wall -W -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi/usr/share/qt4/mkspecs/linux-g++ -I. -I/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi//usr/include/qt4/QtCore -I/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi//usr/include/qt4/QtGui -I/opt/dey/1.6.2/graphical/sysroots/cortexa9hf-vfp-neon-dey-linux-gnueabi//usr/include/qt4 -I. -I. -o main.o main.cpp
/bin/sh: 1: XX: not found
make: *** [main.o] Error 127
16:10:58: Le processus “/usr/bin/make” s’est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet test_Qt (kit : ccimx6sbc)
When executing step “Make”
16:10:58: Temps écoulé : 00:00.

Has someone any idea?

Thank you

You seem to be using DEY 1.6.2
can you try it with DEY 1.6.5 or 1.6.6 ?

Here are some notes on building QT:

  1. bitbake meta-toolchain-qt (without trailing e)

This compiles a toolchain/SDK with QT support for X11. This means you can use this toolchain standalone (out of Yocto) to compile QT applications that will be run later on a graphical system with X11 windowing system.

  1. bitbake meta-toolchain-qte

This compiles a toolchain with QT support as well. You can use it out of yocto but the QT applications you built with it are meant to be run on a non-X11 system, so it’s QT over framebuffer (what we used to have in DEL). At runtime you need to pass -qws as argument for the QT apps to run.

Now, the inconsistency of Yocto is that it requires a project configured with X11 support (in DISTRO features) even though you want to compile meta-toolchain-qte (which is not going to use X11 for anything).

So a DEY project configured to build dey-image-minimal with our requirement:

DISTRO_FEATURES_remove = “x11”

fails to build meta-toolchain-qte.

You need to use a project without that setting (for example a project for dey-image-graphical) to build a toolchain with QT-for-framebuffer meta-toolchain-qte.