Build an embedded QT Environment

Source: Internet
Author: User
Tags high cpu usage

Arm-Linux Embedded QT/E Environment (QT/e 3.x Series)

The QT/e 3.x series has significant improvements over the QT/e 2.x series, greatly improving the development progress. tmake is no longer used and easier to install. However, the QT/E 3. x series is rarely introduced on the Internet. Therefore, this article describes how to install the QT/E 3. x series.

I. Build an arm cross-compilation tool chain

Before installing QT/e, make sure that the arm-Linux cross-compilation toolchain has been established. If not, follow these steps to create it.

1、download cross compilation tool cross-2.95.3.tar.bz2 (or other versions such as: cross-3.4.4.tar.bz2), this is already produced arm cross compilation tool chain, just extract and establish diplomatic environment variables can be used.

2. copy the file cross-2.95.3.tar.bz2 to a folder. Here I use the/usr/local/ARM directory. Note that the subsequent environment variables must correspond to them.

3. Decompress tar-xjvf cross-2.95.3.tar.bz2

4. create the environment variable export Path =/usr/local/ARM/2.95.3/bin: $ path

Or you can write it into a file ~ /. Bashrc, so you don't need to use the export every time you start the system.

VI ~ /. Bashrc

Add export Path =/usr/local/ARM/2.95.3/bin: $ path

Now the arm-Linux cross-compilation tool chain has been built.

2. Compile QT

1. QT/e free edition can be downloaded from ftp on the official website. URL: ftp://ftp.trolltech.com/qt/source. You can select a version to download. I personally think that the QT/e 3.x series is relatively easy to use, but the QT/e 2.x series has a lot of online materials. However, we recommend that you do not use the QT/e 3.3.x version because I have tried QT/e 3.3.4 and QT/e3.3.8 during my development and found that they account for a high CPU usage on the arm Development Board, I have been accounting for about 98% of the CPU. I have not found the reason. I wonder if any of my friends has encountered this problem. We recommend that you use QT/e 3.1.0. I am using it and have no problems.

(Note: the problem has been solved. It turns out that the keyboard interface is not ready. If you have time, share with you the process of porting the keyboard interface)

2. Here, I assume that the qt-embedded-free-3.1.0.tar.bz2 is used.

3. Copy the qt-embedded-free-3.1.0.tar.bz2 file to a folder. Here I use the directory/usr/local/arm. Note that the subsequent environment variables must correspond to them.

4. Unzip the tar-xjvf qt-embedded-free-3.1.0.tar.bz2

Change the unzipped folder qt-embedded-free-3.1.0 to QTE. (You do not need to change it. This is for convenience. Note that the environment variables should correspond to them later)

Music qt-embedded-free-3.1.0 QTE

5. Create Environment Variables

VI ~ /. Bashrc

Add

Export qtdir =/usr/local/ARM/QTE
Export qtedir = $ qtdir
Export Path = $ qtdir/bin: $ path
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH

(Please log in again to make the environment variable take effect)

6. Configure QT

Go to the QT/e Directory: CD $ qtdir

Input:./configure-Embedded ARM-thread-no-cups-qvfb-depths, 16, 32

-Embedded ARM indicates that the target platform is arm.-thread indicates that QT threads are supported and used in development.-qvfb indicates that the virtual buffer frame tool qvfb is supported.-depths, 16, 32 indicates that the color depth can be 4, 8, 16, and 32 characters. There are many other options not listed one by one. Please refer to./configure-help.

There is also an option I'm useless with-qconfig local, you can write some switch variables into a file qconfig-local.h and put it under $ qtdir/src/tools. You can refer to the qconfig-small.h, qconfig-medium.h, qconfig-large.h and other files under this directory, directly use them as well, such as:-qconfig small. With these switch variables, you can remove components that are not needed during development to reduce the size of the QT library. Here we should be familiar with QT, so Beginners should ignore it first.

(I have compiled $ qtdir/include/qvaluestack at home. h. An error occurred while uploading the file. Later, the file corresponding to qt3.3.8 was copied and overwritten. It is estimated that the file is incompatible with the GCC version, I have never encountered this problem in my company)

7. Compile

Make sub-Src // specify to compile the development kit in simplified mode, that is, some QT classes are not compiled
Translation.

8. Test

At this point, the compilation is complete, and finally the test is successful. We can use the example of QT to test the function, for example:

CD $ qtdir/examples/aclock // or you can create a new QT project.

Make clean // clear the original

RM *. Pro makefile // Delete and recreate the project file

Qmake-Project

Qmake-spec $ qtdir/mkspecs/qws/Linux-arm-G ++-O makefile

-Spec specifies the target board configuration file. Here I am working on the Linux ARM platform. Note that $ qtdir/mkspecs/qws/Linux-arm-G ++ is not a compiler, it is a configuration file, and the compiler used during compilation is the compiler in the arm cross-compilation toolchain established in the first step.

Make

If no error occurs, your QT/e environment has been successfully created. If cannot find-lqte is prompted, you can modify the MAKEFILE file, find-lqte, and change it to-lqte-MT. This is because the library it generates is no longer libqte. so.3.1.0 but a libqte-mt.so.3.1.0 If QT threads are used or for other reasons, so it cannot be found.

3. porting to the Development Board (the following are all in the target machine environment)

1. Create a directory, such as/QT/lib. Go to the directory CD/QT/lib

2. Download the above QT library file libqte-mt.so.3.1.0 to the development board/QT/lib/directory through FTP. (Note: Do not use wget download, will damage the library file, and the emergence of LD. So: dynamic-link.h: 62: elf_get_dynamic_info: assertion '! "Bad dynamic tag "''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''' ''' failed !. This error)

3. Create a QT database connection:

Ln-s libqte-mt.so.3.1.0 libqte-mt.so

Ln-s libqte-mt.so.3.1.0 libqte-mt.so.3

Ln-s libqte-mt.so.3.1.0 libqte-mt.so.3.1

4. Create Environment Variables

VI ~ /. Bashrc

Add

Export qtdir =/QT
Export qtedir = $ qtdir
Export LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH

4. The target board environment has been created. Now you can download the above example aclock to the target board and try again to run it!

Enter./aclock-qws in the development board console.

If it can run but cannot be used on the keyboard, it is normal because QT/E has not been added to the interfaces of the keyboard, mouse, and other devices. This is not a sentence or two, so I will try again later!

Note: if there is a prompt like this :". /aclock: Error while loading shared libraries: libstdc ++. so.6: cannot load shared object file: no such file or directory. "You can find the corresponding library files in the/usr/local/ARM/2.95.3/ARM-Linux/lib/directory of the arm cross-compilation tool chain established in step 1 to download them the/lib directory of the Development Board.

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.