Qt4.6.3 porting to mini2440

Source: Internet
Author: User

Some time ago, I made an article on porting qt4.6.3 to mini2440, and I have also reproduced it. I found that many problems have been encountered according to the above, and now I have recorded some of them,
To avoid detours in the future.
First, refer to the mini2440 User Manual on the mini2440 CD.
(A) Good compiler, software packages in the arm-linux-gcc-4.4.3. The software package is arm-linux-gcc-4.4.3.tar.gz.
(2 ). Describearm-qte-4.6.3-20100802.tar.gz, unzip and enter the arm-qte-4.6.3
(1 ). Mini2440 has made a ready-made script build-all for the compilation of our QtE-4.6.3, so, directly./build-all
This process will take a long time. Depending on the machine configuration, there will be different compilation times.
During this period, I encountered a problem:

../Corelib/tools/qbytearray. cpp: 54: 18: Fatal error: zlib. H: No file or directory
Fatal error: zlib. H: No file or directory
This error occurs because the zlib package is not installed. After installation, the problem can be solved. Note that the installation command is: sudo apt-Get install zlib1g-dev, instead of sudo apt-Get install zlib

(2) After successful execution, run the mktarget script,
./Mktarget
Will be extracted from the compiled target file directory
The QtE-4.6.3 library file and executable binary example to be packaged as a target-qte-4.6.3.tgz.

(3). decompress the above package in the root directory of the Development Board and use the following command:
# Tar xvzf target-qte-4.6.3.tgz-C/
In this way,
The trolltech directory will be created under the/usr/local/directory,
It contains all the library files and executable programs required for running.
At the same time, I set up the bin directory under/usr/local/trolltech/QtEmbedded-4.6.3-arm/on the board (my bin directory didn't exist)
(2 ). Install touch screen verification tool
(1) Put the tslib-1.4.tar.gz in a directory, such as/OPT directory. Run the following command:
Tar zxvf tslib-1.4.tar.gz then
(2) Source autogen. Sh
Then
(3)./configure -- prefix =/usr/local/tslib -- Host = arm-linuxac_cv_func_malloc_0_nonnull = Yes

(4) After: Make
I encountered an error:
In file encoded ded from/usr/include/fcntl. h: 252: 0,
From/usr/include/sys/fcntl. h: 1,
From ts_calibrate.c: 20:
In function 'open ',
Inlined from 'main' at ts_calibrate.c: 227: 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
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
Make [2]: Leaving directory '/home/Ouyang/downloads/tslib/tests'
Make [1]: *** [All-recursive] Error 1
Make [1]: Leaving directory '/home/Ouyang/downloads/tslib'
Make: *** [all] Error 2
The solution is as follows because the compiler syntax check is strict:
In the source file./tests/ts_calibrate.c

// Source file
// If (calfile = getenv ("tslib_calibfile "))! = NULL ){
// Cal_fd = open (calfile, o_creat | o_rdwr );
//} Else {
// Cal_fd = open ("/etc/pointercal", o_creat | o_rdwr );
//}
// You need to change it to the following format:
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 );
}

Save and re-compile.
(5) make install
If the above steps are correct, we can see the library files we need under/usr/local/tslib, which will be used for porting.
(4 ). Port to mini2440:
(1) Create the following directory on the Board:
/Usr/local/tslib
Copy all the files compiled and installed on the PC to the Development Board/usr/local/tslib /.
(2 ). Run the following command: VI/etc/profile:

Export qtdir =/usr/local/trolltech/QtEmbedded-4.6.3-arm
Export qpedir =/usr/local/trolltech/QtEmbedded-4.6.3-arm
Export tslib_root =/usr/local/tslib
Export Path = $ qtdir/bin: $ path
Export tslib_consoledevice = none
Export tslib_fbdevice =/dev/fb0
Export tslib_tsdevice =/dev/input/event0
Export tslib_plugindir = $ tslib_root/lib/TS
Export tslib_conffile = $ tslib_root/etc/ts. conf
Export tslib_calibfile =/etc/pointercal
Export qws_mouse_proto = tslib:/dev/input/event0
Export qws_display = linuxfb:/dev/fb0
Export qws_size = 240x320
Export LD_LIBRARY_PATH = $ tslib_root/lib: $ qtdir/lib:/usr/local/lib: $ ld_library

(3) modify the/usr/local/tslib/etc/ts. conf file on mini2440: remove the # And space before # module_raw input in the second line, save and exit.
The configuration file is as follows:
Module_raw Input
Module pthres pmin = 1
Module variance Delta = 30
Module dejitter Delta = 100
Module linear
Then, perform touch screen correction:
CD/usr/local/tslib/bin
./Ts_calibrate (this step is described in detail in the mini2440 User Manual)

(4 ). First, compile the program on the PC, enter the program (q_c) directory, and then execute the following command: (q_c is the directory of the QT program written by myself)
// Usr/local/trolltech/QtEmbedded-4.6.3-arm/bin/qmake

(5 ). After execution, run the following command: whether file q_c is a binary file. If yes, it indicates that the compilation is successful and can be transplanted to the mini2440 Development Board.

Copy the compiled program q_c to the development board/usr/local/trolltech/QtEmbedded-4.6.3-arm/bin/directory.

Then run./q_c-qws-fonts wenquanyi through the terminal. At this time, I encountered the following problem:
./Q_c:/lib/libc. so.6: Version 'glibc _ 100' not found (required by/usr/local/trolltech/QtEmbedded-4.6.3-arm/lib/libqtgui. so.4)

Because I deleted all QTE-related files in the previous file system. Added all tslib files and the Lib folder generated after qt-everywhere-opensource-src-4.6.3 compilation and installation in/usr/local/trolltech/QtEmbedded-4.6.3-arm copied to the Development Board file system. Then the/etc/profile and configuration file are modified.
This problem occurs in the Lib folder, which is the library file of the arm-Linux-GCC compiler. I used the advanced arm-Linux-GCC version to compile QT. All new arm-Linux-GCC lib versions should also be transplanted under Lib.
The solution is as follows:
Update the Lib folder. Use the library of the new compilation tool instead.
At this time, the Chinese on my board cannot be normally displayed, so:
(6) environment variable settings when the font is displayed on mini2440:
First, make sure that the/usr/local/TR .. /Q .. /lib/fonts (this path depends on your actual situation) has the font_wenquanyi wenquanyi font. If it does not exist, click the next one on the Internet.
Then the path is based on your actual situation:
My path is/usr/local/TR ../Q ../lib/fonts. Add this path to/etc/profile.
Export qt_qws_fontdir =/usr/local/tr.../Q ../lib/Fonts
Then source/etc/profile
Now, OK

However, I have another problem:
In this Code:

Qstring mainwindow: stringtounicode (qstring Str)
12 {
13
14 // tr must be added to the string sent here, And qtextcodec: setcodecfortr (qtextcodec: codecforlocale () can be added to the main function ());
15
16 // STR = tr ("hello ");
17 const qchar * q;
18 qchar qtmp;
19 qstring str0, Strout;
20 int num;
21 // int Len = Str. local8bit (). Length ();
22 q = Str. Unicode ();
23 int Len = Str. Count (); // There is a problem
24
25 qdebug () <"lenthe = ";
26 qdebug () <Len;
27 For (INT I = 0; I <Len; I ++)
28 {qtmp = (qchar) * q ++;
29 num = qtmp. Unicode ();
30 qdebug () <num;
31 if (Num & lt; 255)
32 Strout + = "00"; // Add "00" before an English letter or number"
33 str0 = str0.setnum (Num, 16); // The hexadecimal number.
34 Strout + = str0;
35
36}
37
38 return Strout;
39}
This function converts qsting into Unicode codes that can be directly used by the GSM module.
When I call this function, the parameter I passed is "happy work !", Run int Len = Str. Count ();
The value I get is 5. If the value is 13 on mini2440, I don't know how to solve it ......
If any Daniel knows how to solve the problem, I hope to give some advice to the younger brother ..

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.