Cherry Zheng

MY-IMX6-EK140 Qt4.8.5 porting

Discussion created by Cherry Zheng on Feb 27, 2018

If you would like to know more about products and technology, please visit our webiste www.myzr.com.cn or email to enquiry@myzr.com.cn

porting Qt4.8 of ARM version

tslib porting

Compile tslib library

1 unzip tslib

unzip tslib-master

2 Into the tslib directory, specify the cross-compile tools
export CC=/home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc-4.9.23

3 generate the configuration file

./autogen.sh
4 configure

./configure --host=arm-linux-gnueabihf --prefix=/usr/local/tslib
5 compile

make
6 install

sudo make install 
Tslib directory will be generated in / usr / local when the installation is completed.

7  Get into the cross-compiler tools library directory, copy the compiled tslib library to cross-compile tools library directory

cp /usr/local/tslib/lib/libts* ./ -a

 

 

porting Qt

Compile tslib library

1 unzip Qt source code

tar xvf qt-everywhere-opensource-src-4.8.5
2 Get into Qt source code directory

vim mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf
3 revise cross-compile tools

  # modifications to g++.conf
  QMAKE_CC = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc-4.9.2 -lts
  QMAKE_CXX = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-g++ -lts
  QMAKE_LINK = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-g++ -lts
  QMAKE_LINK_SHLIB = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-g++ -lts

  # modifications to linux.conf
  QMAKE_AR = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-ar cqs
  QMAKE_OBJCOPY = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-objcopy
  QMAKE_STRIP = /home/myzr/6ul-tools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-strip
  保存退出(Save & Esc)

4 vim mkspecs/common/linux.conf

在QMAKE_LIBS_THREAD = -lpthread 后面添加(Added later) -lts :
QMAKE_LIBS_THREAD = -lpthread -lts
保存退出(Save & Esc)
5 configure

./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -little-endian -host-little-endian -no-opengl -no-openssl -nomake examples -nomake docs 
6 compile

make
configure needs about 1-2 hours
7 install

sudo make install
Trolltech will be generated in / usr / local directory when the installation is completed.

compile tslib plugin

1 in Qt source code directory

cd src/plugins/generic/tslib/
2 Copy the tslib header file to the current directory cp /usr/local/tslib/include/tslib.h ./

3 compile

make
4 install

sudo make install
libqtslibplugin.so will be generated in /usr/local/Trolltech/QtEmbedded-4.8.5-arm/plugins/generic/ local directory when the installation is completed.

Development board environment building

copy library

1 Copy Trolltech directory in /usr/local to /usr/local directory in development board


2 Copy tslib directory in /usr/local to /usr/local directory in development board

 

set environment variables

1 vi /etc/profile

add:
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_FBDEVICE=/dev/fb0

export LD_LIBRARY=/usr/local/Trolltech/QtEmbedded-4.8.5-arm/lib
export QT_QWS_FONTDIR=/usr/local/Trolltech/QtEmbedded-4.8.5-arm/lib/fonts
export QWS_MOUSE_PROTO=tslib:/dev/input/event1
保存退出(Save & Esc)
Now, the Qt operating environment of development board has been set up.

Qt application compilation

set up Qtcreator environment

1 Download Qt installation package from Qt’s website): http://download.qt.io/archive/qt/5.5/5.5.0/

qt-opensource-linux-x86-5.5.0.run 是linux下32位的(32 bit);
qt-opensource-linux-x64-5.5.0-2.run 是linux 下64位的(64 bit)。
(download as needed)
2 Put the installation package into linux after downloading, double-click with the mouse to run, will pop-up installation interface, install it according to your needs.

3 You will get a Qt Creator (Community) after the installation is completed , may not be visible on the desktop, you can search for "Qt" in linux and open it; you can also find qtcreator in the Qt installation directory under Tools / QtCreator / bin / , then open it and run it.

  To find “Build & Run" in menu Tools -> Options

Add "Compilers", "add" add cross compiler tools, select the front compiler Qt source cross compiler tools

Add "Qt Versions", "add" add qmake, select the front compiled qmake (/ usr / local / bin / qmake).

Add "Kits", "add" Add a Kit, name it yourself, then select "Compiler" and "Qt Version", which are the "Compiler" and "Qt Version" that you selected in the two steps above.

  Finally “Ok” Esc

Qt application created

1 menu: File->New File or Project。

2 Application -> Qt Widgets Application。 

3 Enter the project name, choose to created path, next step

4 kit selection, select the Kit added in 2.4.1; next step.

5 Enter the name of the class, here with the default, "Base class" to select QWidget, next step

6 Finish。 =

7 Forms have a ui file, double-click to open it.

8 There is a label in the left column under the Display Widgets, drag the mouse to the design interface, and then double-click the label, type "hello world!". 

9 Compile, click the lower left corner of the hammer shape button to compile, compile will be created in the directory to create an executable file, put it on the development board can run. 

 

If you would like to know more about products and technology, please visit our webiste www.myzr.com.cn or email to enquiry@myzr.com.cn

 

Outcomes