[Qtopia of Embedded Development Technology] installation and cross-compilation documentation (2) -- Compilation and installation of various QT versions for x86 host Edition

Source: Internet
Author: User
Tags i18n

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

 

1. Compile and install various QT for x86 host edition:
1) Preparations
$ Sudo apt-Get install gcc-3.3 g ++-3.3 build-essential libx11-dev
Libxext-dev UUID-dev libjpeg-dev zlib1g-dev zhcon
Where:
Gcc-3.3, G ++-3.3 is gcc3.3 and does not use the 4.3.1 that comes with the system, because gcc4 may fail when compiling the QT3-X11.
Build-essential is required for compiling programs in Ubuntu/Debian.
Lib-x11-dev is a development library for X11.
Libxext-Dev is an extension development library of xfree86 3.x. The preceding two packages are required for compiling QT Based on X11.
UUID-Dev, UUID is the string of the storage device in the standard guest system. It aims to help the user uniquely identify all storage devices in the system. It can identify the DVD drive, USB storage device, and hard disk device in the system. This is a uuid development library.
Libjpeg-Dev is the JPEG development library.
Zlib is a common compression library. The above three are all necessary peripheral libraries.
Zhcon is a Chinese console. It is an external hanging platform and is different from the kernel in Chinese.
After the kernel is patched and zhcon is executed on the main console, you can enter the Chinese platform.
<--------------------------------------------------
$ CD/usr/bin
$ Sudo ln-SFP gcc-3.3 gcc
$ Sudo ln-SF g ++-3.3g ++
Create a soft link for gcc3.3
<--------------------------------------------------
$ Cd ~
$ Mkdir myqt
$ MV desktop/qtopia-free-src-2.2.0.tar.gz myqt /.
$ MV desktop/qt-x11-free-3.3.8b.tar.gz myqt /.
$ MV desktop/qt-embedded-free-3.3.8b.tar.gz myqt /.
$ CD myqt/
$ Tar zxvf qtopia-free-src-2.2.0.tar.gz
$ MV qtopia-free-2.2.0/qtopia-host
$ Tar zxvf qt-embedded-free-3.3.8b.tar.gz
$ MV qt-embedded-free-3.3.8b QT-embedded-host
$ Tar zxvf qt-x11-free-3.3.8b.tar.gz
$ MV qt-x11-free-3.3.8b qt3-x11
Move several installation packages from the desktop to the myqt directory in the home directory, and decompress and rename the packages.
Meaning:
The Qt3-x11 is the host version of The Qt-X11, QT-embedded-host is the host version of QT/embedded,
Qtopia-host is the motherboard qtopia.
2) Qt-X11 installation and basic use
$ Qt3-x11 CD
$ (Echo yes) |./configure
$ Make
$ Sudo make install
$ Sudo CP-r lib/*/usr/local/lib
$ Sudo CP-r include/*/usr/local/include
This is the basic way to compile and install the qt-X11, if there is an error, you should have a look at the front of the package is installed.
<--------------------------------------------------
$ Export qtdir = $ pwd
$ Export Path = $ qtdir/bin: $ path
$ Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
Set the variables required by QT temporarily
$ Mkdir qtprogram/Hello-P
$ CD qtprogram/thello
$ VI hello. cpp
The source file is as follows:

#include <qapplication.h>#include <qlabel.h>int main(int argc, char *argv[]){QApplication app(argc, argv);QLabel *label = new QLabel("Hello Qt!", 0);app.setMainWidget(label);label->show();return app.exec();}

Compile our program now.

Generate. Pro project file

$ Qmake-Project

Generate the MAKEFILE file:

$ Qmake

Compile:

$ Make

Run:

$./Hello

A very small hello window will appear.

3) install and run the qtopia2.2.0 host

$ CD qtopia-host/

$ CP/usr/local/bin/UIC qt2/bin /.

$ (Echo yes) |./configure

$ Make

$ Make install

This is the basic method for compiling and installing qtopia. After make install, the system will generate the entire file tree of qtopia in the image folder. The structure and files are used by qtopia. Of course, some libraries, font libraries, and help documents can be simplified, we will do this in the embedded porting section.

<--------------------------------------------------

$ CD qtopia/

$ Mkdir-P image/opt/QT/lib

$ CP-R ../qt2/lib/image/opt/QT/lib

$ RM image/opt/QT/lib /*

Copy the font library in the qt2 directory to the image, so that the overall file architecture is clear, and then delete the link library used by qt2.

<--------------------------------------------------

$ Export qtdir =/home/Inno/myqt/qtopia-host/qtopia/image/opt/QT

$ Export qpedir =/home/Inno/myqt/qtopia-host/qtopia/image/opt/qtopia

$ Export LD_LIBRARY_PATH = $ qtdir/lib: $ qpedir/lib: $ LD_LIBRARY_PATH

$ ../Qt2/bin/qvfb &

$ CD image/opt/qtopia/bin/

$./Qpe &

This is the basic step for running qtopia. First, set the environment variable R. qtopia will view qtdir/lib/fonts at runtime. The main purpose of this operation is to load the font. Then set qpedir and LD_LIBRARY_PATH. During the runtime, qtopia will find the dynamic link library of the relevant system foundation and plug-in. To enable the virtual framebuffer, the virtual Frame Buffer uses the shared storage area (Virtual Frame Buffer) to simulate the frame buffer and in a window (qvfb) simulate an application to display the frame buffer.

Qtopia runs on it.

Qpe is the main program of qtopia.

$ Make lupdate

This ensures that all files required for translation exist and are up-to-date. Make lupdate generates a translation file for each language by adjusting the "language" configuration option of qtopia, the name is named after a appname-cn-ZH.ts.

$ Bin/nct_lupdate

Generate translation files for strings that cannot be found in the source code.

$ VI/qtopia-host/qtopia/i18n/zh_cn/. Directory

[Translation]

File = qtopiai18n

Context = Chinese (Mainland)

[Desktop entry]

Name [] = Chinese (Mainland)

Each language requires a. Directory to set the language, which will be displayed in the qtopia language.

$ CD http://www.cnblogs.com/

$ Make lupdate

Update again.

$ CD i18n/zh_cn

$ Linguist

Open each ts file and write Chinese characters in the translation. Note that when you press crtl + enter, the green check mark is displayed, indicating that the update is successful. Save each file.

$ Touch qtopiaringtones. Ts qtopiathemes. Ts

During make install, two files may not exist, so you can create two empty files.

$ VI $ qpedir/i18n/ZH-CN/qtopiadefaults. Ts.

In <Name> fontmap </Name>, modify the small part

<Message encoding = "UTF-8">

<Source> small, Helvetica, 10 </source>

<Translation> simsun, simsun, 11 </translation>

</Message>

Change the default font to simsun. The fonts font and Its Configuration directory are already available at http://blogimg.chinaunix.net/blog/upfile2/081109125513.gz.

$ Lrelease *. Ts

Use lrelease to generate QT message files. There will be two warning, of course, caused by the two meaningless Empty files just now.

$ CD http://www.cnblogs.com/

$ Make lupdate

$ Make install

Install the file to the image directory

Export qpedir =/home/Inno/myqt/qtopia-host/qtopia/image/opt/qtopia

Export qtdir = $ qpedir

Export Path = $ qpedir/bin:/home/Inno/myqt/qtopia-host/qt2/bin: $ path

Export LD_LIBRARY_PATH = $ qpedir/lib: $ LD_LIBRARY_PATH

Then, set the environment variable in image/opt/qtopia,

$ CD $ qpedir/bin

$ Qvfb &

$./Qpe &

Run qtopia.

Then select fonts in appearance settings in settings, and select Chinese in language.

5) install QT-embedded

$ Export qt2dir =/home/Inno/QT/Qt-embedded-host/

$ Export qtdir = $ qt2dir

$ Export qtedir = $ qt2dir

$ Export Path = $ qtdir/bin: $ path

$ Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH

$ Cd qt-embedded-host/

$./Configure

$ Make

$ Make install

Note that you only need to select 16 digits for deep color selection.

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.