编译Ts lib
1.下载交叉编译工具链
从官网https://www.veryarm.com/arm-linux-gnueabihf-gcc 下载 或者 https://download.csdn.net/download/pes2020/12833173 下载
解压到并拷贝到/opt/arm-linux-gnueabihf
sudo cp -r ./gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf /opt/arm-linux-gnueabihf
2.配置PATH
gedit /etc/profile
末尾添加
export PATH=/opt/arm-linux-gnueabihf/bin:$PATH
3.下载tslib
官网下载 https://github.com/libts/tslib/releases/download/1.22/tslib-1.22.tar.xz
解压后在代码文件夹编写生成Makefile的脚本 cfg_debug.sh
./configure \
--host=arm-linux \
--prefix=/opt/arm/debug/ \
CC=/opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc \
CFLAGS="-g"
cfg_release.sh
./configure \
--host=arm-linux \
--prefix=/opt/arm/release/ \
CC=/opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc \
CFLAGS="-O3"
运行sudo cfg_debug.sh后看有没有报错 生成Makefile
sudo make 编译
sudo make install 将bin和include lib等拷贝到*–prefix=* 指定的位置
编译Qt
1.下载源码
官网 https://download.qt.io/archive/qt/5.9/5.9.7/single/qt-everywhere-opensource-src-5.9.7.tar.xz 下载源码
解压
tar -xvf qt-everywhere-opensource-src-5.9.7.tar.xz
2.编辑交叉编译平台的qmake配置qmake.conf
选择\qt-everywhere-opensource-src-5.9.7\qtbase\mkspecs\linux-arm-gnueabi-g++\qmake.conf 编辑
#
# qmake configuration for building with arm-linux-gnueabihf-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QT_QPA_DEFAULT_PLATFORM=linuxfb
# modifications to g++.conf
QMAKE_CC = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
QMAKE_CXX = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy
QMAKE_NM = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -P
QMAKE_STRIP = /opt/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip
load(qt_config)
3.添加生成Makefile的配置脚本
在代码根目录添加cfg_debug.sh
#!/bin/bash
./configure \
-prefix /opt/arm/debug \
-xplatform linux-arm-gnueabi-g++ \
-opensource \
-debug \
-confirm-license \
-no-opengl \
-no-pch \
-shared \
-no-iconv \
-no-harfbuzz \
-no-evdev \
-skip qtdeclarative \
-nomake examples -nomake tests \
-no-ssl \
-tslib \
-I /opt/arm/debug/include \
-L /opt/arm/debug/lib
4.编译
添加脚本权限 chmod 755 cfg_debug.sh
执行脚本 cfg_debug.sh