1. Preparation:
ubuntu system reference
Install Ubuntu14.04 in VirtualBox : https://blog.csdn.net/u012166958/article/details/80040082
2. Download qt and tslib, fsl cross compiler
Baidu cloud download: link: https://pan.baidu.com/s/1_8mycKSHYeKwalBdwH4nLA password: pbg9
3. Install gcc-4.6.2.tar in the /opt/ folder
# cp /media/sf_share/gcc-4.6.2.tar / home / ubuntu / tar # cd / home / ubuntu / tar # sudo tar jxvf gcc-4.6.2.tar.bz2 -C /opt/
4. Configure the environment
First install two tools, automake and libtool.
$ sudo apt-get install automake libtool
If the path of the cross compiler has not been added to the PATH, you must first add the path to the PATH. The cross compiler used in this example has The path is /opt/fsl-linaro-toolchain/bin
(be sure to specify the cross compiler path of your own target board), then execute the following command
$ export PATH=$PATH:/opt/gcc-4.6.2/fsl-linaro-toolchain/bin $ export CC=/opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-gcc $ export AR=/opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-ar $ export LD=/opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-ld
View configuration results
$ echo $PATH
5. The files required for the installation part
#sudo apt-get install ia32-libs libc6-i386 #sudo apt-get install libc6-i386 #sudo apt-get install automake libtool #sudo apt-get install ia32-libs #sudo apt-get install lib32ncurses5 lib32bz2-1.0 #sudo apt-get install vim #sudo apt-get install libc6-dev #sudo apt-get install build-essential #sudo apt-get install --reinstall binutils $ sudo apt-get install lib32stdc++6 $ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
6. Compile and
configure tslib, the installation path can be set through the --prefix parameter, here is installed to the tslib in the current directory, and the execution directory is: ../tslib
$ ./autogen.sh
$ $ sudo apt-get install automake libtool
./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --prefix=$PWD/tslib --host=arm-none-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes
After compiling and installing
$make
$make install
, tslib will be installed in the current directory. There is a tslib directory in the current directory. Before entering the next step, first put the second line of the ~/qt-arm/tslib/tslib/etc/ts.conf file #module_raw The input comment is removed and it becomes module_raw input. Note that it must be the top grid
Seven, compile Qt
1. Unzip
$ cd ~/qt-arm $ cp qt-everywhere-opensource-src-4.8.6.tar.bz2 ./ $ tar -xjvf qt-everywhere-opensource-src-4.8.6.tar.bz2 $ cd qt-everywhere-opensource-src-4.8.6
2. Specify the cross compiler
Open mkspecs/qws/linux-arm-g++/qmake.conf in the decompressed directory:
After opening qmake.conf with vim, replace all arm-linux- with arm-none-linux-gnueabi- (note: it depends on your own board, and you must add the path of the cross compiler to the PATH variable first), and add On -lts, then save and exit, the changes are as follows:
$ vi mkspecs/qws/linux-arm-g++/qmake.conf
# modifications to g++.conf QMAKE_CC = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-gcc -lts QMAKE_CXX = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-g++ -lts QMAKE_LINK = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-g++ -lts QMAKE_LINK_SHLIB = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-g++ -lts # modifications to linux.conf QMAKE_AR = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-ar cqs QMAKE_OBJCOPY = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-objcopy QMAKE_STRIP = /opt/gcc-4.6.2/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-strip
As follows, first specify the path of qt installation through --prefix, specify the include path of tslib in the previous step after -I, and specify the lib path of tslib in the previous step after -L
./configure --prefix=$PWD/qt4.8.6-arm -opensource -release -shared -Declarative -importdir /opt/imports -fast -no-largefile -qt-sql-sqlite -qt3support -exceptions -xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -make examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch -I/home/ubuntu/qt/tslib/tslib/include -L/home/ubuntu/qt/tslib/tslib/lib -confirm-licenseYou can execute ./configure --help to view the detailed description of the parameters
, and configure the appropriate parameters as needed .
8. Configure the compiled qt to compile the ARM qt application with qmake on the host
1. Set environment variables Execute the following commands in the current terminal ofthe host (such as Ubuntu):
$ export PATH=$PATH:~/qt-arm/qt-everywhere-opensource-src-4.8.6/qt4.8.6-arm/bin
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/qt-arm/ qt-everywhere-opensource-src-4.8.6/qt4.8.6-arm/lib
Or add the above commands to the /etc/profile file, so that these environment variables are automatically set when the system is logged in.Nine, transplant Qt to ARM development board
There are only two things to be used on the development board, one is the compiled tslib, and the other is the lib directory under the compiled qt directory. Follow the steps below to copy these two directories to the development board.1. Packaging lib
After our Qt installation is complete, in order to solve the problem of symbolic links, we can use the method of packaging first, and then directly decompressing it to the development board:
$ cd ~/qt-arm/qt-everywhere-opensource-src-4.8.6/qt4.8.5-arm $ tar -zcf lib.tar.gz lib $ cd ~/qt-arm/tslib $ tar -zcf tslib.tar.gz tslib
Copy the packaged compressed files lib.tar.gz and tslib.tar.gz to the development board, and then unzip:
$ mkdir -p /usr/local/qt4.8.5-arm $ tar xzvf lib.tar.gz -C /usr/local/qt4.8.5-arm $ tar xzvf tslib.tar.gz -C / usr / loacal2. Set the environment variables
on board Create a new file named setqtenv on the target board,
vi setqtenvand add the following:
export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH export QTDIR=/usr/local/qt4.8.6-arm export T_ROOT=/usr/local/tslib export PATH=$T_ROOT/bin:$PATH export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR/lib:$LD_LIBRARY_PATH export TSLIB_CONSOLEDEVICE=none export TSLIB_FBDEVICE=/dev/fb0 export TSLIB_TSDEVICE=/dev/input/event0 export TSLIB_PLUGINDIR=$T_ROOT/lib/ts export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf export TSLIB_CALIBFILE=/etc/pointercal export QWS_KEYBOARD=USB:/dev/input/event1 export QWS_MOUSE_PROTO=Tslib:/dev/ input/event0 export QT_QWS_FONTDIR=$QTDIR/lib/fontsExecute the following commands to set the settings of the qt environment variables:
1. source setqtenv qt4.8.6
under ARM can be used!