Build and port the embedded QT development environment to the Development Board -- QT learning notes

Source: Internet
Author: User

After many days of QT transplantation, we finally got it out today. Record the learning process, but it makes me sad.

Let's talk about the QT source code package. I was very confused when I first installed QT, And I had X11, embedded, and everywhere. Now I understand that X11 can be installed to develop applications running on a PC, and some QT development tools designer and qvfb will be generated. Install embedded to develop QT applications running on the Development Board. To use everywhere, you need to extract three copies. You can use different configure parameters to install QT on different platforms, including the two mentioned above. X11, x86, and arm respectively. X86 programs can run in qvfb. This eliminates the need for the Development Board. If QT is installed in Windows, you only need to download an EXE file and install it directly. You need to configure environment variables. (Finally)

Let's talk about the QT program in Windows and Linux.

Windows QT and Linux QT can be used the same, as long as the new system re-use qmake-project; qmake; make (Windows is a mingw32-make) compile the three commands. Make sure to set environment variables. Otherwise, the command cannot be found.

I. Build an embedded QT program development environment.

Step 1: Install QT on the PC.

Download the source code package of qtat ftp://ftp.qt.nokia.com/qt/source. Qt-everywhere-opensource-src-4.8.1.tar.gz
Put it in the/root/Qt directory.

Tar-zxvf
Qt-everywhere-opensource-src-4.8.1.tar.gz command decompress, change the decompressed directory name to qtx11.

# Cd qtx11

#./Configure

# Gmake (this step takes a long time, four or five hours)

# Gmake install

This is just installed, installed in/usr/local/trolltech/Qt-4.8.1

# Export Path = "/usr/local/trolltech/Qt-4.8.1/bin: $ path"

# Qmake-V (if the version number can be output, the installation is successful)

Next, compile qvfb.

# Cd/root/QT/qtx11/tools/qvfb

# Gmake

# Cp/root/QT/qtx11/bin/qvfb/bin

# Qvfb (if a virtual window appears, the compilation is successful)

Step 2: Install QT for x86

# Cd/root/QT/

# Tar-zxvf
Unzip the qt-everywhere-opensource-src-4.8.1.tar.gz command and change the unzipped directory name to qtx86.

# Cd qtx86

#./Configure-embedded x86-QT-GFX-qvfb-QT-KBD-qvfb-QT-mouse-qvfb (this command can run the application in qvfb, saving the Development Board)

# Gmake (long time)

# Gmake install

Installation directory in/usr/local/trolltech/QtEmbedded-4.8.1/

# Export Path = "/usr/local/trolltech/QtEmbedded-4.8.1/bin: $ path"

# Qmake-V (if the version number can be output, the installation is successful)

Copy the compiled qvfb in the previous step to/usr/local/trolltech/QtEmbedded-4.8.1/bin.

Step 3: Install the cross-compilation tool arm-Linux-GCC. My version is 4.3.2.

# Tar xvzf arm-linux-gcc-4.3.2.tgz-C/(c needs to be capitalized, unzip and install it in/usr/local/ARM/4.3.2/

# Vi/etc/profile (add path)

Add the following content: exportpath = "$ path:/usr/local/ARM/4.3.2/bin"

# Arm-Linux-gcc-V (if the output version number indicates that the installation is successful)

Step 4: Cross-compile tslib-1.4

Download tslib-1.4.tar.gz to the/root/QT/directory.

# Cd/root/QT/

# Tar zxvf tslib-1.4.tar.gz

# Cd tslib

# Export cc =/usr/local/ARM/4.3.2/bin/ARM-Linux-GCC // set the C Compiler

# Export cxx =/usr/local/ARM/4.3.2/bin/ARM-Linux-G ++ // set the C ++ Compiler

#./Autogen. Sh (if an error occurs, install Autoconf, automake, and libtool (such as Yum installautoconf ))

# Echo "ac_cv_func_malloc_0_nonnull = yes"> arm-linux.cache // avoid checking ac_cv_func_malloc_0_nonnull

#./Configure -- Host = arm-Linux -- cache-file = arm-linux.cache-prefix =/usr/local/tslib

# Gmake

# Gmake install (installed in/usr/local/tslib)

# Vi/usr/local/tslib/etc/ts. conf (modify ts. conf:

Module_raw Input

Module pthres pmin = 1

Module variance Delta = 30

Module dejitter Delta = 100

Module linear

(The following is used on the corresponding development version ,)

Download the entire/usr/local/tslib content above to the corresponding path in the development version (/usr/local /)

Configure Environment Variables

Add the following content:

Exporttslib_root =/usr/local/tslib

Exporttslib_tsdevice =/dev/input/event0

Exporttslib_calibfile =/etc/pointercal

Exporttslib_conffile = $ tslib_root/etc/ts. conf

Export tslib_plugindir = $ tslib_root/lib/TS

Export tslib_fbdevice =/dev/fb0

Exportld_library_path = $ LD_LIBRARY_PATH: $ tslib_root/lib

Then restart the Development Board and input./ts_calibrate on the terminal. The touch screen five-point calibration screen is displayed, and the transplantation is successful.

However, I did not succeed after entering the command, but moved all the library functions.

Step 5: Install QT for ARM

# Cd/root/QT/

# Tar zxvf
Unzip the qt-everywhere-opensource-src-4.8.1.tar.gz command and change the name of the decompressed directory to qtarm.

# Cd qtarm

#. /Configure-Embedded ARM-xplatform qws/Linux-arm-G ++-QT-mouse-tslib-I/usr/local/tslib/include-L/usr/local/tslib /lib

# Gmake

# Gmake install

Installation directory in/usr/local/trolltech/QtEmbedded-4.8.1-arm/

# Export Path = "/usr/local/trolltech/QtEmbedded-4.7.1-arm/bin: $ path"

Then input # qmake-V (if the version number can be output, the installation is successful)

Step 6: create three files for setting three environment variables

# Vi ~ /. Setenv-qtx11.sh

The content is as follows:

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

Export qtdir =/usr/local/trolltech/Qt-4.8.1/

Export LD_LIBRARY_PATH =/usr/local/trolltech/Qt-4.8.1/lib: $ LD_LIBRARY_PATH

# Vi ~ /. Setenv-qtx86.sh

The content is as follows:

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

Export qtedir =/usr/local/trolltech/QtEmbedded-4.8.1-arm/

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

# Vi ~ /. Setenv-qtARM.sh

The content is as follows:

Export Path =/usr/local/trolltech/QtEmbedded-4.8.1/bin: $ path

Export qtedir =/usr/local/trolltech/QtEmbedded-4.8.1/

Exportld_library_path =/usr/local/trolltech/QtEmbedded-4.8.1/lib: $ LD_LIBRARY_PATH

Next, how to use it:

Assume that a project directory is hello.

(1) want to run on the computer.

# Source ~ /. Setenv-qtx11 (for environment variables to take effect)

# Cd hello

# Qmake-Project

# Qmake

# Make

#./Executable File

In this way, you can

(2) want to run on qvfb

# Source ~ /. Setenv-qtx86 (for environment variables to take effect)

# Cd hello

# Qmake-Project

# Qmake

# Make

# Qvfb & (Open qvfb. If an error occurs, open qvfb in X11)

#./Executable file-qws

(3) want to run on the Development Board

# Source ~ /. Setenv-qtarm (enable environment variables to take effect)

# Cd hello

# Qmake-Project

# Qmake

# Make

The executable file can only be run on the Development Board. Download to Development Board

(The Development Board needs to have QT library, directly copied from the PC on the line, will/usr/local/trolltech/QtEmbedded-4.8.1/lib libqtgui. so *, libqtcore. so *, libqtnetwork. so * copy to the/usr/lib directory of the Development Board directory. Copy libstdc ++. So * And LibPNG. So * under the lib directory of the cross compiler to the/usr/lib directory of the Development Board .)

Set Development Board Environment Variables

# Exportld_library_path =/usr/local/tslib/lib:/usr/lib/: $ LD_LIBRARY_PATH

Then you can execute the compiled QT program. Run the command again in the directory where the program is located.

./Executable file-qws

The above content is the environment configuration in Linux.

Assuming that the Qt-2009-05 is installed in windows, the installation directory is in D:/QT/2009.05/

Choose my computer> Properties> advanced> environment variable to edit the PATH variable. Add the following content:

; D: \ QT \ 2009.05 \ mingw \ bin; D: \ QT \ 2009.05 \ QT \ bin

In this way, you can use the qmake-project, qmake, mingw32-make command

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.