Qt4.8.3 transplant summary_author: wuyuan

Source: Internet
Author: User
Tags automake

Author: wuyuan
Please note that this article is from the wuyuan's blog reposted. Thank you!

Article address:

Http://wuyuans.com/2012/11/qt4-8-3-transplant/

Qt4.8.3 transplant conclusion time: November 10, 2012 comments
Category: Linux,

Embedded

I recently bought the one-day tq210 and transplanted the latest qt4.8.3. Now I will make a summary to facilitate future viewing.
QT is a cross-platform C ++ application development framework that is widely used to develop GUI programs. With the software developed by QT, the same code can be compiled and run on any supported platform without modifying the source code. It automatically displays the unique graphic interface style of the platform based on the platform.
QT is widely used in embedded development. With QT, you only need to write an application and UI once, and you can deploy it across different desktop and embedded operating systems without re-writing the source code, it saves both time and development costs.

0. compiling environment

Operating System: Debian wheezy 32-bit
GCC version: 4.7.1
Arm-Linux-GCC: 4.4.6 (for tq210 embedsky tech)
Development Board: tq210 (days embedded)
LCD screen: 7-inch (800x480)

1. Install tslib

Why install tslib? The main purpose is to calibrate the touch screen and deshake functions, so that you can better use the touch screen or install it.
: Http://sourceforge.net/projects/tslib.berlios/files/
The tslib1.4 mentioned on the internet is actually tslib1.0.4. How can it become 1.4, sweat... This tool is relatively small. Just compile it after configuration.

123456 tar
-xvjf tslib-1.0.
tar.bz2cd
tslib-1.0
./autogen.sh./configure
--prefix=/opt/tslib-1.0 --host=arm-linux ac_cv_func_malloc_0_nonnull=yesmakemake
install

Prefix is behind the installation directory, customized by yourself, installed after modification/opt/tslib-1.0/etc/ts. conf, remove the # sign before module_raw input, and then copy the files in/opt/tslib-1.0 into the Development Board, for example, I put it in/usr/local. Configure the environment variables of the Development Board so that tslib can work properly.

12345 export
set TSLIB_FBDEVICE=/dev/fb0export
set TSLIB_TSDEVICE=/dev/event4export
set TSLIB_CONFFILE=/usr/local/etc/ts.confexport
set TSLIB_CALIBFILE=/etc/pointercalexport
set TSLIB_PLUGINDIR=/usr/local/lib/ts

Run ts_calibrate in/usr/local/bin for calibration. If the calibration succeeds, an interface is displayed, and you are asked to click the cross symbol to generate the/etc/pointercal file, this is the calibration configuration file for the touch screen.
Problems:
1. Error in autogen, prompt

./Autogen. sh: 4: autoreconf: not found

This is because automake is not installed in the system.

1 aptitude install
autoconf automake libtool

2. An error occurred while making. The prompt is displayed.

In function 'open ',
Inlined from 'main' at ts_calibrate.c: 229: 11:
/Usr/include/bits/fcntl2.h: 51: 24: Error: Call to '_ open_missing_mode' declared with attribute error: open with o_creat in second argument needs 3 arguments
Make [2]: *** [ts_calibrate.o] Error 1

This is because the OPEN function syntax does not comply with the latest GCC, and the third parameter of open is added to/tests/ts_calibrate.c:

12345 if
((calfile =
getenv("TSLIB_CALIBFILE")) != NULL) {    cal_fd = open (calfile, O_CREAT | O_RDWR, 0777);} else
{    cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777);}
2. Install qt4.8.3

For ease of development, we generally write a program on the PC end, simulate the program, debug the program, and then use arm-Linux-GCC to compile the program into the arm version, and then copy it to the Development Board for running. Therefore, we must compile two sets of QT library files: PC and arm.

2. 1. Install QT for Linux/X11

Download Page: http://qt-project.org/downloads
Choose QT libraries 4.8.3 for Linux/x11to go to qt-everywhere-opensource-src-4.8.3.tar.gz. This file is the same as QT libraries 4.8.3 for Embedded Linux. Different versions can be compiled based on different configurations, unzip, configure, and make.

12345 tar
-xvzf qt-everywhere-opensource-src-4.8.3.
tar.gzcd
qt-everywhere-opensource-src-4.8.3
./configure
-prefix /opt/qt-4.8.3-x11makemake
install

Because the library is large, it takes some time to compile it. After the compilation is complete, install. The installation directory after-prefix is modified as needed.
Error during compilation, prompt

G ++: Error: Unrecognized command line option '-fuse-LD = Gold'

This is a bug in QT: https://bugs.webkit.org/show_bug.cgi? Id = 89312
In a system with a gold linker installed, the-fuse-LD = gold option is added to the compilation script, but this option is not supported by GCC. The solution is to remove this option, find the file src/3 rdparty/WebKit/source/common. PRI, and shield qmake_lflags + =-fuse-LD = gold.

1 #    QMAKE_LFLAGS+=-fuse-ld=gold
2. Install QT for embedded

The source code is the same. Just reconfigure it.

123 ./configure
-prefix /opt/qt-4.8.3-arm -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -qt3support -no-xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2
-no-svg -webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -
make
libs -nomake examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb
-qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -I
/opt/tslib-1.0/include
-L/opt/tslib-1.0/libmakemake
install

The configuration option should be selected based on your own hardware, so that the compiled library file will be relatively small. After installation, copy the imports, Lib, mkspecs, and plugin folders in the directory to the/opt/Qt directory on the Development Board. The directory is just the same as that in the environment variables. Then configure the environment variables of the Development Board so that he can find QT.

1234567891011 export
set QTDIR=/opt/Qtexport
set QPEDIR=/opt/Qtexport
set LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATHexport
set QT_QWS_FONTDIR=$QTDIR/lib/fonts/export
set QWS_SIZE=800x480export
set QWS_DISPLAY="LinuxFb:mmWidth80:mmHeight120:0"export
set QWS_DISPLAY="LinuxFB:/dev/fb0"export
set QT_PLUGIN_PATH=$QTDIR/plugins/export
set QWS_KEYBOARD="TTY:/dev/tty1"export
set QWS_MOUSE_PROTO="TSLIB:/dev/event4"export
PATH=$QTDIR/bin:$PATH
3. Install QT creator

Qt creator is an IDE for developing QT programs. Of course, you can also use command lines for development. Choose http://qt-project.org/downloadsand select QT creator 2.6.0 for Linux/X11 32-bit. If it is a 64-bit system, select the 64-bit version. Download the qt-creator-linux-x86-opensource-2.6.0.bin and run the installation.

1 ./qt-creator-linux-x86-opensource-2.6.0.bin

Configure qmake after installation, go to the tool> Options> build and run> QT version, add qmake installed X11 and arm versions, and add qmake in their respective bin folders, the result is as follows.

Add a cross-compilation tool chain gcce.

OK. Now the configuration is complete. Let's test it.

4. Hello QT

Create a file or project-> qt gui application-> next, select embedded Linux, and remove X11 in details (X11 is on PC), as shown in.

Keep the default settings. After that, open the interface file, add a hello QT label, Build-> Run.

In the lower left corner, switch to the embedded Linux version, build, copy the compiled hello_qt file to the Development Board, and run./hello_qt with an error:

Qwssocket: connecttolocalfile cocould not connect: Connection refused
No QT for Embedded Linux Server appears to be running.
If you want to run this program as a server,
Add the "-qws" command-line option.

Follow the prompts to add-qws and run it again.

1 ./Hello_Qt
-qws

Succeeded. Check that the original QT operation requires a QT service process. After adding-qws, the current QT program is treated as the server.
So far, all QT transplantation has been completed.

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.