It took a long time to finally port qt to the mini2440 Development Board. It could not be said that it was a great success, but it was a great step to complete the process. Here we will explain the porting process.
Porting environment:
Win7 system, the virtual machine is ubuntu12.04
Friendly arm mini2440 Development Board
Qt version: 4.8.6 cross compiler version: 4.4.3
1. Establish the Virtual Machine QT Development Environment
1. Download the source code package of QT from the official QT Website: http://qt-project.org/downloads. the downloaded version is 4.8.6 or another version.
2. files required to install QT
Sudo apt-Get install qt4-dev-tools # Development Kit sudo apt-Get install qtcreator # ide sudo apt-Get install qt4-doc # development help documentation sudo apt-Get install qt4-qtconfig # Configuration tool sudo apt-Get install qt4-demos # demo source code QT
3. Download and pressurize the source code package
tar zxvf qt-everywhere-opensource-src-4.8.6.tar.gz
4. Enter the pressurized folder and start Configuration
[email protected]virtual-machine:/11rwzhou/qt_leran/qt-everywhere-opensource-src-4.8.6# ./configure
The following message is displayed during Configuration:
Which edition of Qt do you want to use ?Type ‘c‘ if you want to use the Commercial Edition.Type ‘o‘ if you want to use the Open Source Edition.
In this way, select o
Then, the following message is displayed:
This is the Open Source Edition.You are licensed to use this software under the terms ofthe Lesser GNU General Public License (LGPL) versions 2.1.You are also licensed to use this software under the terms ofthe GNU General Public License (GPL) versions 3.Type ‘3‘ to view the GNU General Public License version 3.Type ‘L‘ to view the Lesser GNU General Public License version 2.1.Type ‘yes‘ to accept this license offer.Type ‘no‘ to decline this license offer.Do you accept the terms of either license?
After the configuration is complete, the MAKEFILE file will be generated, and then the make statement will be executed. The process of executing make will be long. Please be patient. Different computer configurations may take different time, generally two or three hours, after make is complete, execute the make install command, after the completion will generate the/use/local/trottrch/Qt-4.8.6 folder.
In fact, our system has a qmake command. In the // usr/bin directory, you can use qmake-V to view its version. The version is different. You can modify the qmake generated by our compilation to an environment variable, that is, the/etc/profile file, or modify the qmake link path under/usr/bin, view the attributes of/usr/bin/qmake and you can find that it is linked to/etc/alternatives/qmake. You can make the following modifications:
[email protected]:/# rm /etc/alternatives/qmake [email protected]:/# ln -s /usr/local/Trolltech/Qt-4.8.4/bin/qmake /etc/alternatives/qmake
5. Install QT-creator
On the official website to download the source file, I downloaded is the qt-creator-linux-x86-opensource-2.6.1.bin, add executable permissions to the file, and run
chomd u+x qt-creator-linux-x86-opensource-2.6.1.bin./qt-creator-linux-x86-opensource-2.6.1.bin
The subsequent installation will be the same as the installation of common software.
The page after installation is shown in:
Now, you can use qtcreator for development. However, we only set up a desktop development environment and did not set up an embedded development platform environment, so what we need to do next is to build an embedded development platform environment, which is also cumbersome.
Build an embedded development platform environment
1. Transplantation of tsilib
Tslib is a software library for the calibration of resistive touch screens. It is an open-source program that provides functions such as filtering, deshake, and calibration for the sampling obtained by the touch screen driver, usually as the Adaptation Layer of the touch screen driver, provides a unified interface for the upper application, specific transplantation process see another blog: http://www.cnblogs.com/rwzhou/p/3830404.html
2. Cross-compilation and installation of QT
Similar to compiling on the PC platform, decompress the source code package we downloaded before. to configure the embedded platform, generate a configuration file:
vim autoconfig.sh
The configuration file content is:
#!/bin/sh./configure -opensource -confirm-license -release -shared -embedded arm -xplatform qws/linux-arm-g++ -depths 16,18,24 -fast -optimized-qmake -pch -qt-sql-sqlite -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -little-endian -host-little-endian -no-qt3support -no-libtiff -no-libmng -no-opengl -no-mmx -no-sse -no-sse2 -no-3dnow -no-openssl -no-webkit -no-qvfb -no-phonon -no-nis -no-opengl -no-cups -no-glib -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-separate-debug-info -nomake examples -nomake tools -nomake docs -qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/libexit
This file is copied by others, so some statements are not very familiar.-QT-mouse-tslib \ indicates that tslib is used to drive the screen, -I/usr/local/tslib/include \-L/usr/local/tslib/lib indicates that the tslib library is supported. When we compile tslib, the path must match.-xplatform qws/Linux-arm-G ++ \ indicates that cross-compiler is used for compilation. Then, run./AutoConfig. Sh on the terminal.
After the configuration is complete, generate the makefile with the following prompt:
Qt is now configured for building. Just run ‘make‘.Once everything is built, you must run ‘make install‘.Qt will be installed into /usr/local/Trolltech/QtEmbedded-4.8.4-armTo reconfigure, run ‘make confclean‘ and ‘configure‘.
The next step is to execute the make and make install commands, the installation file/usr/local/trolltech/QtEmbedded-4.8.6-arm will be generated after the installation is complete
3. Set up the Development Board platform environment.
Copy the cross-Environment Library of QT we generated to the Development Board, directory in/usr/local/trolltech/QtEmbedded-4.8.6-arm/lib, you can use NFS sharing method to copy the library file to the Development Board, you can create a new folder on the Development Board to store the QT library files, as shown below:
Next, set the environment variables and modify the/etc/profile file.
Export tslib_tsdevice =/dev/input/event0export tslib_calibfile =/etc/pointercal export tslib_conffile =/etc/ts. conf export tslib_plugindir =/lib/TS export tslib_fbdevice =/dev/fb0 export qtedir =/opt/qtarm // the corresponding path must be set to export Path = $ qtedir/bin: $ PATH export qt_qws_fontdir = $ qtedir/lib/fonts // corresponding to the Library supports export qws_mouse_proto = tslib: /dev/input/event0 // the enumerator of the QT mouse device to create the export qws_keyboard = none export LD_LIBRARY_PATH =/lib: $ qtedir/lib: $ LD_LIBRARY_PATH // library file path export qws_size = 320*240 export qws_display = "linuxfb: mmwidth50: mmheight75: 0 "//
This is the most important step. If the environment variable settings are incorrect, the compiled QT program cannot run normally. We will analyze the specific problems later.
4. Build the environment with QT-creator
Open QT-creator, open tool-option, and go to the build and run configuration directory.
First, add QT versions. One is the PC platform and the other is the ARM platform. Select the corresponding qmake program.
The corresponding compiler is GCC and cross compiler.
Add the arm build kit. The following configuration corresponds to the specific options. This adds the arm build kit.
Next, you can write a simple application. After the application is built, it cannot be used normally on the Development Board. For example, you can simply create a project, drag several controls in the editing box, and then build the project, we can use the desktop build for building and run it directly, and the result will appear.
We can use our new arm build kit for building. Because our arm build kit is not deployed, we click the hammer icon to build it.
As long as the configuration is correct, the build is normal. After the build is complete, it will be generated under the project directory.
Enter the folder, find the execution file, and download it to the Development Board. If the executable file name is hello_world, It will be executed on the terminal.
. /Hello_world-qws should display the same interface on the Development Board if it works normally. The button can be clicked and the mouse arrow can move with the touch pen, but problems may often occur, after I run this problem, the following problems occur:
QWSTslibMouseHandlerPrivate: ts_open() failed with error: ‘No such file or directory‘
After this problem occurs, there is a display interface, but the touch pen and mouse are not moved, and the icon exists on the Development Board is also clicked. Therefore, we need to kill the development board interface process, that is, the QT process, run the TOP command to view the process number, run the kill command to kill all processes related to QT, and run the executable file. The same problem still occurs, indicating that the program crashes upon startup, what we see is a false image. The first thing we can think of is the incorrect environment variable settings. Later we found that the configuration of the environment variable was incorrect. Because of its own configuration of tslib, there was a conflict in the path, after modification, it will be displayed normally. Run the executable file, you can use the touch pen to operate the file, or you can close the program, but the font and screen size are not adjusted properly. The next step is how to adjust the file.
From this time on, it is very important to know how to set environment variables. A slightly incorrect setting will make the entire program unable to operate normally. Fighting!
Reference: http://www.cnblogs.com/emouse/archive/2013/01/29/2881311.html