Build an embedded QT Development Environment 1 (it seems good !!! Blog is also quite good !!)

Source: Internet
Author: User

Http://hi.baidu.com/proudboy_linux/blog/item/58d4daeeba84e51ffdfa3cd8.html

 

Build an embedded QT Development Environment

 

Http://hi.baidu.com/proudboy_linux/blog/item/58d4daeeba84e51ffdfa3cd8.html

Build an embedded QT Development Environment

I have 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 the older versions of QT. I like to use a newer version of things. I believe that the new version is certainly better than the old version, but it is not surprising that the new version of QT is really useful and easier to build. At the beginning, many versions of QT made their heads dizzy, such as QT/X11, QT/win, QT/embedded, qtopia core, and qtopia, fortunately, with the Internet, you can always find what you want on the Internet, and you don't need to return to others. Of course, you also have some responsibilities to share your own data. 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 irrelevant to the platform.

2. What is qtopia?

Qtopia is a comprehensive application development platform for Embedded Linux. It is also a user interface for Linux-based PDA (Personal Digital Assistant), smart phone (smartphone), and other mobile devices. In short, qtopia is essentially a combination of PDA and smart phone applications. If you need to develop such products, you can quickly build a PDA or smart phone on the basis of this program. 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, as qtopia core also said. Recently, the name of qiqu company has been changed again. Its new name is QT-embedded-Linux-XXXX. It seems that there are still many vests of QT/embedded.

The following figure shows how to build the QT development platform. My platform is Fedora Core 7, which requires two QT versions:

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) mV 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, we can know that the former is suitable for the X architecture, and the latter is suitable for the ARM architecture. Why do we need two? If you have a development board, you can only compile the QT-embedded version into an ARM architecture. However, many developers will use qvfb in many cases, therefore, 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. programs compiled into the X86 architecture can only run on the x86 Embedded Board. As mentioned above, we need to develop qvfb, but qvfb can only execute X86 architecture applications, so we need to have QT-embedded generate libraries and other files about x86. Why is QT-embedded compiled into arm? 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. Well, now a simple summary, first of all, using the library and development tools provided by the qt-x11 to develop the QT application, then, use QT-embedded to recompile the x86 library and tool to develop the QT application. This is the executable file that can be run on qvfb. Finally, you can use the arm library of QT-embeddedd to compile the program again to obtain executable programs that can run on the arm. 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, rename it to QT-embedded-linux-opensource-src-4.5.0-x86. Then decompress qt-embedded-linux-opensource-src-4.5.0.tar.bz2, and re-run it to 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 there is a development board, you can compile only the QT-embedded version into the ARM architecture. However, it is much more convenient to use qvfb for development. Therefore, it is good to compile an X86 architecture.

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

MV 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

MV 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 framebuffer device/dev/fb0qscreenlinuxfb: CONNECT: no such file or directory
The most common cause is to compile 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. However, if other display devices are installed with QT-embedded, for example, qvfb can be displayed on qvfb, but a plug-in (or driver, which may be confused with the device driver) is required to enable QT-embedded to 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 $ sudo make install
The corresponding path may be different on everyone's 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.