Linux Compiler QT4 Environment _omapl138

Source: Internet
Author: User
Tags scp command

Linux Compiler QT4 Environment _omapl138

There is a Dragon OMAPL138 board, I want to successfully transplant the QT environment and touch screen, this is my second time for the Linux QT Environment transplant, found a lot of problems, need to be re-organized. I compiled, Qt5 version above, the result is unsuccessful, always die in the PDA problem, in the Configure file to add-XCB option, even if I installed XCB all the library files, and finally the problem, I still in the study, waiting to compile Qt5 through, I will re-write a Linux compilation QT5 environment.

This article is not suitable for configuring QT5 environments, do not use on QT5 to prepare
    • Cross-compilation environment (be sure to find the right cross-compilation environment for your board)

    • QTE embedded source code, the file name is like: qt-everywhere-opensource-src-4.8.6.tar.xz

My environment :

    • PC: Ubuntu16.04 (64bit)

    • Cross-compiler toolchain provided by OMAPL138: Arm-arago-linux-gnueabi HTTP://WWW.VERYARM.COM/ARM-NONE-LINUX-GNUEABI-GCC

    • PS: Different platform cross-compiler tool chain is different, basically chip manufacturers out of an arm chip, matching a cross-compiler tool chain.
    • PS: The best way to check whether the board supports the entire tool chain is to write a simple Hello Word program, and then run to the target board, can run out to illustrate the cross-compilation environment.

    • QT Source: qt-everywhere-opensource-src-4.8.6.tar.gz

*:https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qt/into the directory./4.8/4.8.6/single found this file.

    • Tslib 1.4 Touch Screen Support library: tslib1.4
Cross-compilation environment configuration

In fact, we can not configure, anyway, we use the absolute path in the compiler name

In this article I will directly write the path of the cross-compilation environment according to the configuration on my computer, if you configure your words to note the flexibility to modify the path:

I put it in:/home/delvis/opt/toolschain/omapl138 folder

Compiling tslib1.4

For the touch screen signal acquisition, correction, filtering processing, are using open source Tslib, this article uses the Tslib version of the latest tslib1.4 (you can download tslib1.4 from the link provided herein).
1. Copy the downloaded tslib1.4 to the/home/lz/transplant directory (you can select a directory based on your system) and then perform the extract command

tar -vxf tslib-1.4.tar.gz

To switch to the Tslib directory:

cd tslib

Some tools that you must have to install cross-compilation tslib (you can see if it's installed, ubuntu16.04 have these tools, you can skip)

sudo apt-get install autoconfsudo apt-get install automakesudo apt-get install libtool

2. Write the compilation process with a script
Create a new file under the Tslib folder configtslib14.sh

touch autoconfig.shvim autoconfig.shchmod 777 autoconfig.sh

The contents are as follows:

#!/bin/shmake clean && make distcleanecho "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cacheCC=/home/delvis/opt/toolschain/omapl138/arm-none-linux-gnueabi./configure --host=arm-linux --prefix=/home/delvis/opt/tslib1.4 --cache-file=arm-linux.cachemake && make install

Here are some of the areas to note:

    • Cc=/home/delvis/opt/toolschain/omapl138/arm-none-linux-gnueabi This position must be modified to the path of your cross-compilation environment.
    • --prefix=/home/delvis/opt/tslib1.4 This is the path to compile the output, this location to note, a lot of online tutorials output to the/opt/tslib1.4 this path, but this/opt file path requires the permission is root, When we compile and run the path does not use the root user or not add sudo, so it is recommended not to output directly to the/opt folder, but its own user folder.

And then run

./autoconfig.sh

After the execution, we check to see if the installation was successful and execute the command:

ls /home/delvis/opt/tslib1.4

If the Bin,etc,include,lib 4 directories appear as shown, the instructions cross-compile and install tslib successfully. This is the first place here.

Then start our play, cross-compile QT

Cross-compiling QT4.8.6

After the cross-compiling QT succeeds, the compiled file needs to apply two locations, one part needs to be ported to our Development Board, the other part needs to configure the successful library to the PC that we run Qtcreator, the two parts can only be unified before the problem.

1) Prepare the QT source file.

Unzip the downloaded qt-everywhere-opensource-src-4.8.6.tar.gz by executing the following command:

tar -vxf qt-everywhere-opensource-src-4.8.6.tar.gz
cd qt-everywhere-opensource-src-4.8.6
2) Configure the source file

To create schema information:

    • Enter the schema information path (Qt4 's source path is typically)

cd ./qtbase/mkspecs/qws

    • Create a folder (PS: Preview the following file name will affect the later configuration, this thing I have been doing for a long time )

mkdir omapl-g++

    • Go to this folder and create two files

cd omapl-g++; touch qmake.config qplatformdefs.h

    • Modify the Qplatformdefs.h, directly paste the following up, only this sentence.
#include "../../linux-g++/qplatformdefs.h"

If you find that you are not prompted to find the Qplatformdefs.h entire file in the compilation process, just in the folder of other schema information in the Mkspec/qws folder, look at how people write the path, basically your path.

    • To modify the information used by the cross-compilation schema:
gedit qmake.conf

The following information needs to be noted in the qmake.conf file:

    • qmake_cflags_release + = O2-march=xxxxx , is the whole march to pay attention to the platform is what the architecture, such as ARM9 is basically arm5te, CortexA8 have a different architecture, the whole place must be written correctly, or when we build a cross-compilation environment to compile QT project and then run, there will be illeagle instruction. The error prompt. Also some configuration files do not specify this information, preferably also written on.

    • When I am here, even if I am configuring a cross-compilation environment, I am not prompted ARM-LINUX-GNUEABI-GCC to find it, and I take it out on the command line arm-linux-gnueabi-gcc-v The time can also be displayed, I changed four ways to configure the cross-compilation environment, restart n times or not, so I did the qmake.config file on the hands and feet, using the absolute path to configure, did not expect to compile, so I recommend using absolute path on the Qmake.config file. The include after
    • Also looks at what the path to the search file in mkspec/qws/is, possibly the previous level of the directory, or the first two levels of the directory.

# # Qmake configuration for building with arm-linux-gnueabi-g++ #MAKEFILE_GENERATOR = unixconfig + = Inc Rementalqmake_incremental_style = Sublibqt_qpa_default_platform = LINUXFB #eglfs #compiler Flags to take advantage of the A RM architecture#run the Linux terminal command "Arch" to see the detail your target CPU arch information. Qmake_cflags_release + =-o3-march=armv5teqmake_cxxflags_release +-o3-march=armv5teinclude (.. /.. /common/g++.conf) include (.. /.. /common/linux.conf) include (.. /.. /common/qws.conf) # modifications to G++.CONFQMAKE_CC =/HOME/DELVIS/OPT/TOOLSCHAIN/OMAPL/ARM-ARAGO-LINUX-GN Ueabi/bin/arm-arago-linux-gnueabi-gccqmake_cxx =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnueabi/b In/arm-arago-linux-gnueabi-g++qmake_link =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnueabi/bin/arm- Arago-linux-gnueabi-g++qmake_link_shlib =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnueabi/bin/ Arm-arago-linux-gnueabi-g++# modifications to Linux.confqmake_ar =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnu Eabi/bin/arm-arago-linux-gnueabi-ar cqsqmake_objcopy =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnueabi /BIN/ARM-ARAGO-LINUX-GNUEABI-OBJCOPYQMAKE_NM =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnueabi/bi N/arm-arago-linux-gnueabi-nm-pqmake_strip =/home/delvis/opt/toolschain/omapl/arm-arago-linux-gnueabi/bin/arm -arago-linux-gnueabi-stripload (Qt_config)
3) Create a configrue executable file

Go back to QT's top-level directory, create a script file to generate makefile, execute commands

gedit run.shchmod 777 run.sh

Enter the following and save:

./configure -prefix /home/delvis/work/qt-arm-4.8.6 -embedded arm -xplatform qws/omapl138-g++ -no-webkit -qt-libtiff -qt-libmng -no-neon -qtlibinfix E -nomake examples -lrt

which

-prefix/home/delvis/work/ qt-arm-4.8.6 on behalf of us after compiling QT to install the address (this file needs to use two places); You can configure the compilation according to your own needs, remove unnecessary parts, leave the necessary parts, such as: Add-tslib for QT support for the touchpad,-I and- The following are the installation directories for the include and Lib that are compiled tslib for the first step, respectively. (These are not given here for the time being)

Execute command: ( here is recommended with sudo, administrator permissions to configure and compile, many small partners encountered in the tool chain has a thing not called permissions, the results have been a long time to understand, so here to prevent this problem, we use sudo directly)

sudo ./run.sh

The above command automatically generates the makefile file.

*) say a few pits

Before compiling, you need to check the QT compilation environment is not configured well, mainly still a few aspects:

    1. On the command line input: Export
    2. Then output a few find qmakespec this, if there is this, we will remove it, otherwise it will be very painful. We use export-n qmakespec this command to remove the environment variable under the current command window so that we do not have to compile.
4) Start compiling

Execute the command to start compiling: (8 thread compile, if your CPU is not able to withstand 8 threads you can use the double thread-j2 parameter,-a few is a few thread compile)

sudo make -j8

I probably can compile about 10 minutes, at this time CPU utilization reached 100%, temperature if it is notebook, super high. The compilation time depends on how much you configure. the process of compiling can not be smooth sailing, there will always be a variety of errors, if there is a compilation error, then Baidu to solve.
After the compilation is complete, execute the installation command:

sudo make install

We switch to the target directory of the-prefix setting to see if the installation is successful:

cd /home/delvis/work/qt-arm-4.8.6ls

If Qmake appears in the bin directory, it basically succeeds.

Configuring the PC's Qtcreator

This part does not repeat, I found http://blog.csdn.net/u012175418/article/details/52704734 quoted this blog "Set QT Cross-compilation Environment", part, Follow this procedure to configure our newly compiled components and the cross-compilation environment for the QT that just compiled on the PC QT.

Copy files to the target board and configure the Environment 1) transfer Qt4.8.6 to the Development Board

is to copy the environment we just compiled into our target board directory, you can use FTP, you can use the way OTG hangs on the USB drive, I like to use the SSH protocol SCP command.

sudo scp -r /home/delvis/work/qt-arm-4.8.6 [email protected]:/optAfter you enter your password, you can transfer the entire folder to the Development Board.

2) Configure the Development Board environment

After we have transferred, we need to set the environment on the Development Board, we can find the QT library files when we run the QT program.

Open it

vi /etc/profile

Add the following, note that the Qt_root, write the path to QT, and Tslib_root compiled is the path to Tslib.

  export tslib_root=/opt/tslib1.4 export qt_root=/opt/qt-arm-4.8.                                         6 Export Tslib_tsdevice=/dev/input/event2 Export Tslib_tseventtype=input Export tslib_conffile=/opt/tslib1.4                                     /etc/ts.conf Export Tslib_plugindir=/opt/tslib1.4/lib/ts                                                  Export Tslib_consoledevice=none Export tslib_fbdevice=/dev/fb0 Export Qws_mouse_proto=tslib:/dev/input/event2 E Xport ld_library_path=/lib:/usr/lib:/usr/local/lib: $QT _root/lib: $TSLIB _root/libexport qt_qpa_platform_plugin_ Path= $QT _root/pluginsexport qt_qpa_platform=linuxfb:tty=/dev/fb0export qt_qpa_fontdir= $QT _root/lib/fontsexport QT _qpa_generic_plugins=tslib  

When you are done, update the environment.

source /etc/profile

Complete the configuration.

3) Testing

We use QT Creator to make a simple interface, then compile the executable file, the executable file transfer to the target board execution, our executables are called Testem, need to QWS parameters.

./TestEM -qws

Then we can see the interface.

Reference documents:

Http://processors.wiki.ti.com/index.php/Building_Qt

Linux Compiler QT4 Environment _omapl138

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.