Build an embedded QT Development Environment

Source: Internet
Author: User
I recommend that you read a lot of posts about building the QT development platform on the Internet, but I found that the above posts are older and are intended for older versions of QT. I like to use a newer version of things. I believe the new version is definitely better than the old version.
The new version of QT is really easy to use and easy to build. When I first started to get started, many versions of QT made me dizzy, what QT/X11, QT
/Win, QT/embedded, qtopia
Core, qtopia, and so on are really difficult for the second monk to understand. Fortunately, there is a network, the Internet can always find what he wants, and there is no need to return to others. Of course, he also has some responsibility to share with others.
It seems that Communism has begun to sprout on the Internet, haha.

Let's take a look at the various versions of QT:

1. What is QT?

QT is a complete C ++ application development framework. It contains a class library and a tool for cross-platform development and internationalization. Qt
APIs are the same on all supported platforms, and QT tools are used in the same way on these platforms,
Therefore, the development and deployment of QT applications are not related to the platform.

2. What is qtopia?

Qtopia
Is a comprehensive application development platform for Embedded Linux. It is also used for Linux-based PDA (Personal Digital Assistant), smart phone (smartphone), and other
The user interface of the mobile device. In short, qtopia is essentially a combination of PDA and smart phone applications. If you need to develop such products, you can quickly build
PDA or smart phone. Qtopia depends on QT/embedded.

3. What is QT/Embedded?

QT/embedded
Is a complete self-contained GUI and Linux-based embedded platform development tool. The name of this development tool seems to be the most confusing. Of course, QT/Embedded is the most familiar name.
Qtopia
Core is also about it. Recently, the name of qiqu company has been changed. Its new name is QT-embedded-Linux-XXXX. It seems that this QT/Embedded vest is still
A lot.

The following is how to build the QT development platform. My platform is Fedora Core.
7. Two QT versions are required:

Qt-x11-opensource-src-4.3.2.tar.gz

Qt-embedded-linux-opensource-src-4.4.0-rc1.tar.bz2

Qt-x11 version can generate QT development tools, such as designer and so on, the most important is to get qvfb, embedded development with qvfb, You can do not need the actual development board, you can also develop QT applications. The QT-embedded version is specifically used for embedded. The installation steps are as follows:

1. decompress the two QT packages.

A. Tar-jxvf qt-x11-opensource-src-4.3.2.tar.gz

B) tar-jxvf
Qt-embedded-linux-opensource-src-4.4.0-rc1.tar.bz2

C) CP qt-embedded-linux-opensource-src-4.4.0-rc1
Qt-embedded-linux-opensource-src-4.4.0-rc1-x86

D) Music qt-embedded-linux-opensource-src-4.4.0-rc1
Qt-embedded-linux-opensource-src-4.4.0-rc1-arm

Here, QT-embedded has two copies: qt-embedded-linux-opensource-src-4.4.0-rc1-x86
And qt-embedded-linux-opensource-src-4.4.0-rc1-arm, according to their name can know that the former is suitable for the X-frame structure, the latter is suitable
Why are two arm architectures required? If you have a development board, you can compile only the QT-embedded version into the ARM architecture. However, if you use qvfb, the development team
So it is good to compile an X86 architecture. Is there any doubt that the qt-x11 is also suitable for the x86 structure, which is not repeated with QT-embedded? The answer is:
The QT-embedded version can only run on the embedded board, and programs compiled into the X86 architecture can only run on the x86 Embedded Board. As mentioned above, we need qvfb for development,
However, qvfb can only execute X86 architecture applications, so you need to have QT-embedded generate libraries and other files about x86. While compiling QT-embedded into arm,
Why? The principle is very simple. My final QT application needs to run on the ARM architecture. Of course, this library is needed, so compiling it into arm is just a matter of course. Now, let's make a brief summary.
First, use the libraries and development tools provided by the qt-x11 to develop the QT application, and then use the QT-embedded on the x86 library and tool to compile the QT application again,
This is the executable file that can be run on qvfb. Finally, you can use the arm library of QT-embeddedd to compile it again to get the executable program that can be run on the arm. Very bright
Obviously, if there is a development board, the second step is optional (preferably). If there is no development board, the third step is unnecessary, in this way, you do not need to compile QT-embedded into a suitable arm
Architecture.

-----------------------------------------------------------

Steps and instructions:

1. Download the source code package

Qt-x11-opensource-src-4.5.0.tar.bz2

Qt-embedded-linux-opensource-src-4.5.0.tar.bz2

: Ftp://ftp.qtsoftware.com/qt/source/

2. Compile and install qt-x11-opensource-src-4.5.0

Qt-x11 version can generate QT development tools, such as designer and so on, the most important is to get qvfb, embedded development with qvfb, You can do not need the actual development board, you can also develop QT applications. The QT-embedded version is specifically used for embedded.

Tar xjvf qt-x11-opensource-src-4.5.0.tar.bz2

CD qt-x11-opensource-src-4.5.0

./Configure

Make

Make install

After a long compilation process, about one and a half hours, the default installation in/usr/local/trolltech/Qt-4.5.0. After the compilation is complete, Do not delete the source program, there is a use.

3. Compile and install qt-embedded-linux-opensource-src-4.5.0

Create a src directory under the user directory to store the compiling source file QT-embedded-Linux-opensource-Src-
4.5.0.tar.bz2. Decompress it to get the qt-embedded-linux-opensource-src-4.5.0 and rename it to QT-
Embedded-linux-opensource-src-4.5.0-x86.
Decompress qt-embedded-linux-opensource-src-4.5.0.tar.bz2 and run the command QT-embedded-
Linux-opensource-src-4.5.0-arm. Why are there two copies? We can see from their names that the former is suitable for the X architecture, and the latter is suitable
For the ARM architecture, if you have a development board, you can compile only the QT-embedded version into the ARM architecture. However, it is much more convenient to use qvfb in many cases.
Translating an X86 architecture is also good.

Mkdir ~ /Src

Music qt-embedded-linux-opensource-src-4.5.0.tar.bz2 ~ /Src

Tar xjvf qt-embedded-linux-opensource-src-4.5.0.tar.bz2

Music qt-embedded-linux-opensource-src-4.5.0
Qt-embedded-linux-opensource-src-4.5.0-x86

Tar xjvf qt-embedded-linux-opensource-src-4.5.0.tar.bz2

Music qt-embedded-linux-opensource-src-4.5.0
Qt-embedded-linux-opensource-src-4.5.0-arm

CD qt-embedded-linux-opensource-src-4.5.0-x86

./Configure-Prefix/usr/local/trolltech/QtEmbedded-4.5.0-x86
-Embedded
X86-qvfb

Make

Make install

------- OK! Qt-embedded-x86 is installed under/usr/local/trolltech/QtEmbedded-4.5.0-x86.

CD qt-embedded-linux-opensource-src-4.5.0-arm

./Configure-Prefix/usr/local/trolltech/QtEmbedded-4.5.0-arm
-Embedded
Arm

Make

Make install

------- OK! Qt-embedded-arm is installed under/usr/local/trolltech/QtEmbedded-4.5.0-arm.

4. so far we have installed the qt-x11 version, that is, the QT, qt-embedded-x86 version running on the PC (x86 system embedded board running QT) and QT-embedded-arm (QT running on the arm Board ). next step: Set Environment Variables

(1) qt-x11:

VI setenv. Sh

Add the following content:

Path =/usr/local/trolltech/Qt-4.5.0/bin: $ path

LD_LIBRARY_PATH =/usr/local/trolltech/Qt-4.5.0/lib: $ LD_LIBRARY_PATH

Save and exit. Move to/usr/local/trolltech/Qt-4.5.0.

(2) qt-embedded-x86:

VI setenv. Sh

Add the following content:

Qtedir =/usr/local/trolltech/QtEmbedded-4.5.0-x86

Path =/usr/local/trolltech/QtEmbedded-4.5.0-x86/bin: $ path

LD_LIBRARY_PATH =/usr/local/trolltech/QtEmbedded-4.5.0-x86/lib: $ LD_LIBRARY_PATH

Save and exit. Move to/usr/local/trolltech/QtEmbedded-4.5.0-x86.

(3) Qt-embedded-arm:

VI setenv. Sh

Add the following content:

Qtedir =/usr/local/trolltech/QtEmbedded-4.5.0-arm

Path =/usr/local/trolltech/QtEmbedded-4.5.0-arm/bin: $ path

LD_LIBRARY_PATH =/usr/local/trolltech/QtEmbedded-4.5.0-arm/lib: $ LD_LIBRARY_PATH

Save and exit. Move to/usr/local/trolltech/QtEmbedded-4.5.0-arm.

We can run the corresponding script at runtime, for example, we need to use qt-x11:

CD/usr/local/trolltech/Qt-4.5.0

Source setenv. Sh

Then you can use tools such as qmake designer.

5. To achieve this step there is no qvfb compilation, re-compile qvfb to the qt-x11-opensource-src-4.5.0.

CD qt-x11-opensource-src-4.5.0

CD/tools/qvfb

Make
-- Will generate qvfb in qt-x11-opensource-src-4.5.0/bin, we copy it to/usr/local/trolltech/QtEmbedded-4.5.0-x86/bin

CP... bin/qvfb/usr/local/trolltech/QtEmbedded-4.5.0-x86/bin

6. perform a test.

CD/usr/local/trolltech/QtEmbedded-4.5.0-x86

Source setenv. Sh

CD/usr/local/trolltech/QtEmbedded-4.5.0-x86/demos/books

Qvfb-width 640-height 480 &

./Books-qws

-----------------------------------------------------------
The error message is generally
Error opening buffer device/dev/fb0qscreenlinuxfb: CONNECT: no such file
Or
Directory is the x86 version of QT-embedded.
The user
Step 1: After qvfb is run
Step 2 run./MyApp-qws
The preceding error message is displayed.

The reason is that QT-embedded searches for the display device of the system by default for linuxfb, that is, the/dev/fb0 Device of Linux, But If QT-embedded-
Embedded has other display devices installed, such as qvfb, which can be displayed on qvfb, but requires a plug-in (or driver, which may be confused with the device driver) to make QT-
Embedded can use qvfb.
To do this, add the following options to the configure command when compiling QT-embedded:
./Configure-plugin-GFX-qvfb-plugin-KBD-qvfb-plugin-mouse-qvfb
Or./configure-QT-GFX-qvfb-QT-KBD-qvfb
-QT-mouse-qvfb if you do not want to re-compile QT-embedded, you can also compile gfxdrivers of qvfb separately. The command is as follows:
$ Cd
Qt-embedded-linux-opensource-src-4.5.1/src/plugins/gfxdrivers/qvfb/$/usr/local/trolltech/QtEmbedded-4.5.1/bin/qmake $
The path of sudo make install may be different on different machines. Just understand the meaning.

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.