Qt4.8.6 Embedded Linux Compilation and porting

Source: Internet
Author: User

recently bought a flight ok6410 Development Board, so in which build qt4.8.6 operating environment. Spent two or three days, mainly on the Linux system unfamiliar, on some issues linger for a long time, here to do some process notes. Burn Write Arm-linux system , according to the official Infineon User manual successfully for the Development Board burning wrote U-boot, kernel3.0.1, and rootfs.yaffs (all by the Infineon official).

Compilation Environment:

pc:ubuntu12.04 lts,vmware Workstation 10.0.5 build-2443746

Qt:4.8.6 qt-everywhere-opensource-src-4.8.6.tar.gz

Tslib: tslib1.4 provided by the Development Board is not used

Cross compiler: arm-linux-gcc-4.3.2

Compile Preparation:1. Dependent Package Installation

Pure version of Ubuntu no g++ need to be installed first:

[plain] view plain copy print?

  1. Apt-get Install g++
Apt-get Install g++

There are a number of dependent packages installed in many resources: Libx11-dev Libxext-dev Libxtst-dev, although the specific dependencies are not known, the installation will always be correct. Command:

[plain] view plain copy print?

  1. Apt-get Install Libx11-dev Libxext-dev Libxtst-dev
Apt-get Install Libx11-dev Libxext-dev Libxtst-dev

2. Cross-Compiler:

The process of starting with arm-linux-gcc-4.4.3 version cross-compiling qt4.8.6 is very smooth, but after migrating the library to the ok6410 Development Board, run the program using qt4.8.6 compilation, error: GLIBC2.9 not found, after many times verified, The main problem is that the glibc (2.8) used by Infineon's official file system does not match the version of Ubuntu12.04 's glibc (2.15), so it tries to upgrade the GLIBC version of the board, but the level is limited without fruit (if you are not sure of your own custom kernel, file system, And when the time is tight, it is not recommended to toss, except for learning purposes. The last cross compiler uses the 4.3.2 version

3. A few notes on the Tslib version:

At first, the cross-compilation installation of the tslib1.4,tslib provided by the Development Board is very simple. However, after porting the QT Library and environment variables, running the cross-compiled QT program, the ARM Development Board display can render the program interface, indicating that the QT Library migration Basic OK, but the touchscreen cannot move, and HyperTerminal display error "Couldnt load module pthres Qwstslibmousehandlerprivate:ts_config () failed with error: ' No such file or directory ' please check your tslib installati on! ", some information on the Internet may be the Development Board to provide the tslib version is too old, holding a trial mentality, download the latest tslib, finally did not appear the above problems, but also explained the correctness of my environment variable settings.

Porting of Tslib and QT on the Development Board

Main Reference Blog:

Http://www.cnblogs.com/Jasonsblog/p/3757985.html or http://www.cnblogs.com/emouse/archive/2013/01/29/2881311.html;

In addition, one leaf of the wind between the "Linux arm Qt transplant configuration One-click Push remote Debugging Video tutorial ";

qt4.8.6 problems encountered during the compilation process:

1) Missing link library:
[Plain]View Plain copy print?
    1. /USR/LOCAL/TSLIB/LIB/LIBTS.A (TS_LOAD_MODULE.O): in function ' __ts_load_module ':
/USR/LOCAL/TSLIB/LIB/LIBTS.A (TS_LOAD_MODULE.O): in function ' __ts_load_module ':
[Plain]View Plain copy print?
    1. TS_LOAD_MODULE.C: (. text+0x80): Undefined reference to ' Dlopen '
TS_LOAD_MODULE.C: (. text+0x80): Undefined reference to ' Dlopen '
[Plain]View Plain copy print?
    1. TS_LOAD_MODULE.C: (. text+0x90): Undefined reference to ' Dlsym '
TS_LOAD_MODULE.C: (. text+0x90): Undefined reference to ' Dlsym '
[Plain]View Plain copy print?
    1. TS_LOAD_MODULE.C: (. text+0xf0): Undefined reference to ' dlclose '
TS_LOAD_MODULE.C: (. text+0xf0): Undefined reference to ' dlclose '
[Plain]View Plain copy print?
    1. TS_LOAD_MODULE.C: (. text+0x120): Undefined reference to ' dlclose '
TS_LOAD_MODULE.C: (. text+0x120): Undefined reference to ' dlclose '
[Plain]View Plain copy print?
    1. TS_LOAD_MODULE.C: (. text+0x158): Undefined reference to ' dlclose '
TS_LOAD_MODULE.C: (. text+0x158): Undefined reference to ' dlclose '
[Plain]View Plain copy print?
    1. Collect2:ld returned 1 exit status
Collect2:ld returned 1 exit status
[Plain]View Plain copy print?
    1. MAKE[1]: * * * [.. /.. /lib/libqtgui.so.4.8.6] Error 1
MAKE[1]: * * * [.. /.. /lib/libqtgui.so.4.8.6] Error 1
[Plain]View Plain copy print?
    1. MAKE[1]: Leaving directory '/lsj_pro/qt-everywhere-opensource-src-4.8.6/src/gui '
MAKE[1]: Leaving directory '/lsj_pro/qt-everywhere-opensource-src-4.8.6/src/gui '
[Plain]View Plain copy print?
    1. Make: * * [sub-gui-make_default-ordered] Error 2
Make: * * [sub-gui-make_default-ordered] Error 2
Solution:

Modified ./src/gui/makefile

[Plain]View Plain copy print?
    1. ...
    2. LIBS = $ (sublibs)-l/usr/local/tslib-1.4/lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtnetwork-l/usr/local/tslib-1.4 /lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtcore-lpthread-lts
    3. ...
... LIBS          = $ (sublibs)  -l/usr/local/tslib-1.4/lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtnetwork-l/usr/local/ Tslib-1.4/lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtcore-lpthread-lts ...

at the end, add the library LIBDL Library, which is used to dynamically connect the library operations: [Plain]View Plain copy print?
    1. ...
    2. LIBS = $ (sublibs)-l/usr/local/tslib-1.4/lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtnetwork-l/usr/local/tslib-1.4 /lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtcore-lpthread-lts-ldl
    3. ...
... LIBS          = $ (sublibs)  -l/usr/local/tslib-1.4/lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtnetwork-l/usr/local/ Tslib-1.4/lib-l/home/work/qt/qt-4.7.0-arm/lib-lqtcore-lpthread-lts-ldl ...

After saving the exit, switch to the source directory to continue Make-j4.

2) undefined reference to ' __sync_sub_and_fetch_4 ':
the main cause of this is the GCC version issue.
solution (http://blog.csdn.net/zpzkitt/article/details/8970626):

1. Download gcc source code: I later used the 4.4.3 (the system comes with the seemingly useless gcc-4.6.3), decompression, in the gcc-4.4.3/gcc/config/arm/directory to find a linux-atomic.c;

2. Make a link library: Use Libtool to create, enter commands

[Plain]View Plain copy print?
    1. Libtool--tag=cc--mode=compile arm-linux-gcc-g-o2-mt linux-atomic.lo-md-mp-mf linux-atomic. Tpo-c-O Linux-atomic.lo linux-atomic.c

And then:

[Plain]View Plain copy print?
    1. Libtool--tag=cc--mode=link arm-linux-g++-g-o2-o liblinux-atomic.la Linux-atomic.lo
Libtool--tag=cc--mode=link arm-linux-g++-g-o2-o liblinux-atomic.la Linux-atomic.lo

This step will generate the. Libs directory in the current directory;

3. Copy the generated library to a relatively short directory, such as/OPT:

[Plain]View Plain copy print?
    1. CP. libs/liblinux-atomic.a/opt
CP. libs/liblinux-atomic.a/opt

4. Modify QT's makefile:

Enter the QT source directory:

CD qt-everywhere-opensource-src-4.8.6

Then: Vim Src/script/makefile

To modify: in libs = ...... Add -l/opt-llinux-atomic at the end of the

Save, continue Make-j4, and finally execute make install will be OK.

Migrating libraries to the board and setting environment variables

    1. /usr/local/tslib/etc/ts.conf Copy to the Development Board/etc/, switch to/usr/local/tslib/lib/directory, copy files except Pkconfig directory to the Development Board/lib/;
    2. Package QT Library, I used someone else to write a script mk_qt4_target, packaged in the current directory to generate compressed package target-qte-4.8.6.tar.bz2, copy to the Development Board root directory, decompression can see the required QT library files under/usr/local/;
    3. environment variable script qt4_en.sh, which reads as follows:

[Plain]View Plain copy print?
  1. #!/bin/sh
  2. if [-c/dev/input/event2]; Then
  3. Input_path=/dev/input
  4. Else
  5. Input_path=/dev
  6. Fi
  7. Export Tslib_tsdevice=/dev/input/event2
  8. Export tslib_conffile=/etc/ts.conf
  9. Export Tslib_plugindir=/lib/ts
  10. Export tslib_calibfile=/etc/pointercal
  11. Export qtdir=/usr/local/trolltech/qtembedded-4.8.6-arm/
  12. Export path= $QTDIR/bin: $PATH
  13. Export Ld_library_path= $QTDIR/lib
  14. Export qws_mouse_proto= "Tslib: $INPUT _path/event2"
  15. #export qws_mouse_proto= "Tslib: $INPUT _path/event2 mouseman: $INPUT _path/mouse1"
  16. Export Qws_keyboard=tty:/dev/tty1
  17. #sync Font size with Qtdesigner
  18. Export qws_display= "linuxfb:mmwidth200:0"
  19. Export qws_size= "480x272"
  20. Export KDEDIR=/OPT/KDE
  21. Export Home=/root
#!/bin/shif [-c/dev/input/event2]; Theninput_path=/dev/inputelse     input_path=/devfiexport Tslib_tsdevice=/dev/input/event2export TSLIB_CONFFILE= /etc/ts.confexport Tslib_plugindir=/lib/tsexport Tslib_calibfile=/etc/pointercalexport QTDIR=/usr/local/Trolltech /qtembedded-4.8.6-arm/export path= $QTDIR/bin: $PATHexport ld_library_path= $QTDIR/libexport qws_mouse_proto= "Tslib: $INPUT _path/event2 "#export qws_mouse_proto=" tslib: $INPUT _path/event2 mouseman: $INPUT _path/mouse1 "Export Qws_ Keyboard=tty:/dev/tty1#sync font size with Qtdesigner export qws_display= "linuxfb:mmwidth200:0" Export qws_size= " 480x272 "Export Kdedir=/opt/kdeexport home=/root

The above is my Development Board configuration, the specific settings also need to be based on the Development Board hardware to make corresponding changes.

To run the test:

Design a simple UI in QtCreator3.3.0 and compile the copy to the board run, application name: HelloWorld

Run:

[Plain]View Plaincopy print?
    1. ./helloword-qws
    ./helloword-qws
the effect is as follows, click the touch screen reacts, the mouse arrow can move

Qt4.8.6 Embedded Linux Compilation and porting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.