Establishment of QT cross-compilation tool

Source: Internet
Author: User
Tags echo command

Some of them switch to other people, some of my experience!

Learning notes ---- graphical interface program QT installation and Transplantation on 2410
The main content of this article is the installation of the compiler, installation and establishment of the QT desktop runtime environment, cross-Compilation of QT/E, the establishment of the local qtopia virtual platform, and the transplantation of qtopia2.1.1 on 2410.
 
Preparation: Compiler Installation
 
Compiler: arm-linux-gcc-3.4.1.tar.bz2
(The software is downloaded from the Internet. If you don't know where to download it, Google will .)

Copy the software arm-linux-gcc-3.4.1.tar.bz2 to/usr/local and run the following command on the terminal to install the software:
Tar-xjf arm-linux-gcc-3.4.1.tar.bz2

Modify/etc/profile in the/usr/local/ARM/3.4.1/bin directory and add the following line. This allows us to directly run arm-Linux-GCC without having to write all its absolute paths. However, this takes effect only after the restart:
Pathmunge/usr/local/ARM/3.4.1/bin
Hardware: UP-NETARM2410S

In this step, you do not have to download the same version of the Cross-compilation tool. I use 2.95.3. After you finish this step, add the environment variable to the profile and ignore it, in this way, the path is arm-Linux-G ++.

The following installation and environment variable settings are carried out according to the instructions here, but pay attention to the following: select the large mode during configure, or make errors may occur. You can try it, if an error occurs, make clean again.

I followed the instructions and ended at the second point, because I think there is no need to try qtopia for the moment.

In addition, I think the version used here is too low. I will try to use the library files of qt3.

In addition, he used Progen and tmake when cross-generating the compilation file. His usage is a bit wrong. I think I use it like this:
Assume that the hello project contains two files: Hello. h and hello. cpp. Use Progen to generate the pro file. In fact, Progen means the gernerate (generated) tool of the Pro file.
PROGEN-O hello. Pro
Tmake hello. Pro-O makefile
Make
You can check the makefile content in the middle. Note that cxx = arm-Linux-G ++ and link = arm-Linux-G ++.

You can check the file after make. File hello, the system will show that this is an elf file, that is, this is a file executed on the arm!

When cross-compilation generates executable files, that is, when the third point in operation (3) is as follows, if a new terminal is created, some of the temporary environment variables previously defined disappear, and the general system also carries QT, while our embedded QT version is lower than the system, it is best not to set environment variables under the system path. tmake has already been added to the system path, so we need to reset or define it. as follows:

Echo $ tmakepath
Check whether the ending character of the returned result is "... /Qws/Linux-arm-G ++ ". If not, you need to reset tmakepath in the command line.
Export tmakepath =/tmake installation path (for example, $ tmakedir)/lib/qws/Linux-arm-G ++
My system is:
Export tmakepath =/Gg/tmake-1.13/lib/qws/Linux-arm-G ++

Then set qtdir and qtedir:
Qtedir to be set to the QTE folder, export qtedir = $ PWD/qt-2.3.10-target, PWD is my path, my is/GG, that is, export qtedir =/Gg/qt-2.3.10-target
Then, you can use the PROGEN and tmake tools directly by using export qtdir = $ qtedir.

How to generate an elf file and a. o file used on the host?

Method 1:

First, QT of the later version is installed when the system is installed. You can use this QT and use the qmake tool. First, use qtdesigner to create a pro file and some corresponding files. H and. CPP file, such as hello. CPP then, qmake hello. pro, then make to generate makefile, and then make to succeed. /Hello.

Method 2:

It is run using the QT library of the lower-level version installed below. The condition is that these libraries have been installed. One thing to note is to redefine the environment variables according to the path set during installation. otherwise, an error occurs.
Of course, here we will also use qtdesigner to create a pro file and some corresponding. h and. cpp files, and then use Progen and tmake tools to generate makefile!
Another note is that the tool qvfb does not have to be included in tools. You can download a new compilation file on the Internet and run it. You can add the path to the system path for your convenience.

 

1. Install and establish the QT desktop running environment

Software: PC operating system RedHat Linux 9.0 + minicom + ARM-LINUX Development Environment
Tmake-1.13.tar.gz qt-embedded-2.3.10-free.tar.gz
Qt-x11-2.3.2 .tar.gz
The software is downloaded from the Internet. If you do not know where to download it, Google will.
 
Copy the three files used in this experiment to the/root/2410sqt directory. The following steps assume that you are operating under/root/2410sqt.
 
The following steps are required to build the QT/embedded platform:
 
Step 1: extract the installation package and set Environment Variables
Tar-xzvf tmake-1.13.tar.gz
Tar-xzvf qt-x11-2.3.2.tar.gz
Tar-xzvf
Qt-embedded-2.3.10-free.tar.gz
MV qt-2.3.10 qt-2.3.10-host
Export tmakedir = $ PWD/tmake-1.13
Export qt2dir = $ PWD/qt-2.3.2
Export qtedir = $ PWD/qt-2.3.10-host
Setting environment variables is very important. It is related to whether these installation packages can be correctly installed and compiled.
 
Note: In the following installation, run the make clean command before executing the make command.
Step 2: Compile QT/embedded.
 
1. Build qt2.3.2
CD $ qt2dir
Export tmakepath = $ tmakedir/lib/Linux-G ++
Export qtdir = $ qt2dir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
Make clean
./Configure-no-xft
Note that the large Mode
Make
Mkdir $ qtedir/bin
CP bin/UIC $ qtedir/bin/
 
2. Build qvfb
Export tmakepath = $ tmakedir/lib/Linux-G ++
Export qtdir = $ qt2dir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
CD $ qtedir/tools/qvfb
Make clean
Tmake-O makefile qvfb. Pro
Make
MV qvfb $ qtedir/bin/
This step builds qvfb and creates a link from QT/Embedded 2.3.10 to QT 2.3.2 static library. The qvfb tool is used to generate virtual framebuffer, which is a very useful tool that can simulate the display on the development board. If there is no problem running in virtual framebuffer, it can be directly run on the Development Board through cross-compilation.
 
3. Build QT/embedded
CD $ qtedir
Export tmakepath = $ tmakedir/lib/qws/linux-x86-g ++
Export qtdir = $ qtedir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
Make clean
./Configure-no-xft-qvfb-depths, 8, 16, 32
Make
Step 3 view the running result
If the above steps are successfully compiled, you can run
QT/Embedded comes with a demo to view the running results.
● Run on virtual framebuffer:
Export qtdir = $ qtedir
Export Path = $ qtedir/bin: $ path
Export LD_LIBRARY_PATH = $ qtedir/lib: $ qt2dir/lib: $ LD_LIBRARY_PATH
CD $ qtedir/examples/Launcher
Qvfb-width 640-height 480 &
Sleep 10
./Launcher-qws

Cross-Compilation of binary QT/E

To publish the program we wrote to the Development Board, we need to re-compile QT/embedded, similar to the previous compilation on the host machine. The steps are as follows:

1. Build QT/embedded
Tar-xzvf qt-embedded-2.3.10-free.tar.gz
Music qt-2.3.10
Qt-2.3.10-target
Export tmakedir = $ PWD/tmake-1.13
Export qt2dir = $ PWD/qt-2.3.2
Export qtedir = $ PWD/qt-2.3.10-target
CD $ qtedir
Export tmakepath = $ tmakedir/lib/qws/Linux-arm-G ++
Export qtdir = $ qtedir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
Make clean
./Configure-xplatform Linux-arm-G ++-no-xft-no-qvfb-depths, 16, 32
Make
After this step, we will see libqte under the/$ qtedir/lib/directory. so libqte. so.2 libqte. so.2.3 libqte. so.2.3.10. You can run the file command to check whether the library file is the one we need to run on the Development Board.
File libqte. so.2.3.10
Libqte. so.2.3.10: Elf 32-bit LSB shared object, arm, Version 1 (ARM), stripped
With this library, we can copy it to the corresponding library directory in our development board. Here we select the/usr/lib directory on the Development Board, set libqte under/$ qtedir/lib. so * copy to the/usr/lib directory.
First, establish communication between the host machine and the Development Board. Assume that the IP address of the local machine is 192.168.0.56 and/root/share is the shared folder.
CP-ASON/$ qtedir/lib/libqte. So */root/share
Start minicom
Mount-T nfs-O nolock 192.168.0.56:/root/share/mnt/nfs copy the file to the Development Board
CP-Arn/mnt/nfs/libqte. So */usr/lib
 
2. Modify the tmake configuration file
VI $ tmakedir/lib/qws/Linux-arm-G ++/tmake. conf
Replace "tmake_link = arm-Linux-GCC"
"Tmake_link_shlib = arm-Linux-GCC"
Changed to "tmake_link = arm-Linux-G ++"
"Tmake_link_shlib = arm-Linux-G ++"
 
3. generate an executable file
 
Here we use a demo that comes with QT/Embedded. It is in the/$ qtedir/examples/progressbar Directory, which includes the following files: Main. CPP, makefile. in, progressbar. h,
Makefile, progressbar. cpp, and progressbar. Pro. If you already have an execution file for progressbar, you can use make clean to delete it.
PROGEN-T app. T-O progressbar. Pro
Echo $ tmakepath
Check whether the ending character of the returned result is "... /Qws/Linux-arm-G ++ ". If not, you need to reset tmakepath in the command line.
Export tmakepath =/tmake installation path (for example, $ tmakedir)/lib/qws/Linux-arm-G ++
In addition, make qtdir point to the installation path of QT/embedded, such:
Export qtdir = $ qtedir or directly specify the path
Export qtdir = ...... Qt-2.3.10-target
After the preceding environment variable settings are completed and the echo command is used to check whether the errors are correct, you can use the tmake tool to generate the MAKEFILE file. In the command line, enter the following command:
Tmake-O makefile progressbar. Pro
Make
If no error occurs, you can find the executable file progressbar in the current directory, which is to run ". /progressbar-qws "to run the program.

Note: 1) If you execute the command
[/Mnt/nfs]./progressbar-qws
./Progressbar: Error while loading shared libraries: libstdc ++. so.6: cannot open shared object file: no such file or direy
My solution is to find it from the compiler directory and copy it to the Development Board/usr/lib /.

Copy/usr/local/ARM/3.4.1/ARM-Linux/lib/libstdc ++. So * to the Development Board/usr/lib /.
2). [/mnt/nfs]./progressbar-qws
./Progressbar: Error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: no such FY
Same as above

 
 
 
3. Establish the qtopia virtual platform of the Local Machine
 
Software: RedHat Linux9.0 for PC + minicom + embeded linux for 2410
Tmake-1.13.tar.gz qtopia-free-source-2.1.1.tar.bz2 qt-embedded-2.3.10-free.tar.gz qt-x11-2.3.2.tar.gz
Copy the four files required for this experiment to the/root/qtopia directory. The following experiments are conducted in this directory.

The following steps are required to create a virtual qtopia environment on the host:

1. decompress the installation file:
Tar jxvf qtopia-free-source-2.1.1.tar.bz2
MV qtopia-2.1.1 qtopia-2.1.1-target
Tar xzf tmake-1.13.tar.gz
Tar xzf qt-x11-2.3.2.tar.gz
Tar xzf qt-embedded-2.3.10-free.tar.gz
MV qt-2.3.10 qt-2.3.10-target
Export qpedir = $ PWD/qtopia-2.1.1-target
Export tmakedir = $ PWD/tmake-1.13
Export qt2dir = $ PWD/qt-2.3.2
Export qtedir = $ PWD/qt-2.3.10-target
 
2. Build QT/X11:
CD $ qt2dir
Export tmakepath = $ tmakedir/lib/Linux-G ++
Export qtdir = $ qt2dir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
./Configure-no-xft
Make
Mkdir $ qtedir/bin
CP bin/UIC $ qtedir/bin/
 
3. Build qvfb:
Export tmakepath = $ tmakedir/lib/Linux-G ++
Export qtdir = $ qt2dir
Export Path = $ qtdir/bin: $ path: $ tmakedir/bin
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
CD $ qtedir/tools/qvfb
Tmake-O makefile qvfb. Pro
Make
MV qvfb $ qtedir/bin/
 
4. Build libqte:
CD $ qtedir
Export tmakepath = $ tmakedir/lib/qws/linux-x86-g ++
Export qtdir = $ qtedir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
CP-F $ qpedir/src/QT/qconfig-qpe.h src/tools/
./Configure-system-JPEG-no-xft-qconfig qpe-qvfb-depths, 16, 32
Make sub-Src
 
5. Build qtopia:
CD $ qpedir
Export qtdir = $ qtedir
Export Path = $ qpedir/bin: $ path
Export
LD_LIBRARY_PATH = $ qpedir/lib: $ LD_LIBRARY_PATH
./Configure
Make
Similar to the basic steps for compiling QT/embedded, you can also refer to "./configure -- Help" for selection. To ensure that qvfb can correctly display the qtopia results, we must ensure that the environment variables are correctly set. We can use the "env" command to check the following environment variables, you can also use the following method to check.
 
Echo $ qpedir
/Root/qtopia/qtopia-free-2.1.1/
Echo $ qtdir
/Root/qtopia/qt-2.3.10
Echo $ LD_LIBRARY_PATH
/Root/qtopia/qtopia-free-2.1.1/lib:/root/qtopia/qt-2.3.10/lib
Echo $ path
/Root/qtopia/qt-2.3.10/bin:/usr/Kerberos/sbin:/usr/Kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin: /bin:/usr/sbin:/usr/bin:/usr/x11r6/bin:/root/bin
The above result will display the virtual framebuffer normally. We can use the following command to implement qtopia in the virtual framebuffer.
CD $ qpedir/bin
Qvfb &
Sleep 10
./Qpe. Sh
 
Qtopia2.1.1 porting on 2410-s
 
Software: RedHat Linux9.0 for PC + minicom + embeded linux for 2410
Bytes
Success,
Tmake-1.13.tar.gz,tslib.tar.gz, buildqtopia. Sh
 
1. The experiment can be divided into the following steps:
(1) install the cross-compiling environment on a Linux PC. The compiler version installed on the installation CD is low and cannot be compiled properly. Therefore, you need to install QT/tools/arm-linux-gcc-3.4.1.tar.bz2 before compilation and modify the compiler search path in/root/. bash_profile.
(2) Compile the library file:
(3) Compile qt-x11-2.3.2:
(4) Compile and install qt-embedded-2.3.2
(5) Compile and install qtopia
(6) copy the files to the Development Board to a separate folder.
In this experiment, the buildqtopia. Sh file has completed the above steps for everyone. We can directly run this file for compilation. You can analyze the content of buildqtopia. SH and master the compilation steps.
 
2. Compilation steps:
CD SRC
./Buildqtopia. Sh
After compilation, the compiled qtopia desktop environment is in src/qtopia-free-2.1.1/image/opt/qtopia.
Note: After compilation, the directories under SRC correspond to the following software packages:
E2fsprogs-libs-1.37 ext2 File System toolkit, qtopia uses the libuuid
E2fs-install ext2 toolkit compilation results
Jpeg-6b JPEG decoding library
JPEG-install JPEG compilation result
Tslib touch screen Toolkit
Tslib-install touch screen toolkit compilation result
Tmake-1.13 tmake tool, used to compile qtopia
Qt-2.3.2 QT/X11-2.3.2 and compilation results, which need to be used when compiling qtopia
Qt-x11-free-3.3.4 QT/X11-3.3.4 and compilation results, which need to be used when compiling qtopia
Qt-2.3.10 QT/Embedded 2.3.10 and compilation results
Qtopia-free-2.1.1 qtopia 2.1.1 and compilation result
 
3. installation steps:
1) qtopia
CD src/qtopia-free-2.1.1/image/opt/
Tar cvjf/tmp/qtopia-install.tar.bz2 qtopia
Download the/tmp/qtopia-install.tar.bz2 to the target machine and extract it to a directory, assuming/mnt/yaffs.
2) Related Files
Set src/qtopia. SH is downloaded to the/usr/bin directory of the target machine. set src/e2fs-install/lib/libuuid. so * download to the/usr/lib directory of the target machine. set src/JPEG-install/lib/libjpeg. so * download to the/usr/lib directory of the target machine
3) The processing on the target machine is executed on the target machine:
CD/usr
Ln-S/mnt/yaffs/qtopia qpe
Chmod + x/usr/bin/qtopia. Sh
Note: The qtopia. Sh file is not provided on the CD. The following is the qtopia. Sh file.
// Qtopia. Sh
 
#! /Bin/sh
Export qtdir =/usr/qpe
Export qpedir =/usr/qpe
Export kdedir =/usr/qpe
Export tslib_tsdevice =/dev/input/event0
Export tslib_conffile =/tmp/ts. conf
Export tslib_consoledevice = none
Export tslib_calibfile =/tmp/ts-calib.conf
Export
Tslib_plugindir =/usr/qpe/lib
Export qt_tslibdir =/usr/qpe/lib/
Export
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/qpe/lib/
Export qws_size = 640x480
Export
Qws_mouse_proto = "tpanel:/dev/input/event0 USB"
Export lang = zh_cn
Insmod
/Mnt/yaffs/touchscreen/ts-uptech.o
CP/usr/qpe/etc/ts. CONF/tmp
CD/usr/qpe/bin/
If ["$1" = "C"]; then
./Ts_calibrate
Fi
If [-F "$ tslib_calibfile"]; then
./Qpe &>/dev/null
Else
./Ts_calibrate
./Qpe &>/dev/null
Fi
Clear
 
 

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.