Cross compile qt5

The qt5.9.9 source code download address: http://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz

Gcc compiler download address: http://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz

You can download the source code and compiler with wget in the Linux environment.

1. Compilation toolchain configuration:

1. Download the compiler and unzip it to a directory, for example, here is: /home/dave/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf

2. Environment variable configuration, open the file in the user directory: .profile file, add at the end:

export PATH=$PATH:/home/dave/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin

Execute after saving : source .profile makes the environment variable take effect

Two, compile qt5:

1. After decompressing the source code, enter the source code directory: tar -xvf  qt-everywhere-opensource-src-5.9.9.tar.xz

2. Modify the file qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf in the source directory , and replace all arm-linux-gnueabi in it with arm-linux-gnueabihf

3. Write a shell script build.sh to execute the compilation. The content of the script is:

#!/bin/sh

#export PATH=$PATH:/home/dave/toolchain/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin

./configure -prefix $PWD/qt5.9-arm \
-opensource \
-release \
-confirm-license \
-xplatform linux-arm-gnueabi-g++ \
-no-opengl \
-no-pch \
-shared \
-no-iconv \
-no-xcb \
-nomake examples \
-nomake tests \


make -j 4

make install
 

Among them, qt5.9-arm is the directory of files generated after compilation, -nomake examples indicates not to compile example, -nomake tests indicates not to compile test

4. After writing the script, execute the script compilation:

chmod a+x build.sh

./build.sh

 

Guess you like

Origin blog.csdn.net/m0_46455711/article/details/105685463