QT 源码编译


  • 修改qmake.conf

# vi 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_PLATFORM=linuxfb:fb=/dev/fb0:rotation=0

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc
QMAKE_CXX               = arm-linux-gnueabihf-g++
QMAKE_LINK              = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_NM                = arm-linux-gnueabihf-nm -P
QMAKE_STRIP             = arm-linux-gnueabihf-strip
load(qt_config)

# vi make.sh

make.sh内容如下:(注意 \ 后不要有空格)

#!/bin/sh
PWD=`pwd`
    mkdir install
    ./configure \
    -prefix $PWD/install \
    -static \
    -release \
    -opensource \
    -xplatform linux-arm-gnueabi-g++ \
    -optimized-qmake -pch \
    -qt-libjpeg \
    -qt-libpng \
    -qt-zlib \
    -no-opengl \
    -skip qt3d \
    -skip qtcanvas3d \
    -skip qtpurchasing \
    -skip qtlocation \
    -skip qttools \
    -no-sse2 \
    -no-openssl \
    -no-cups \
    -no-glib \
    -no-iconv \
    -tslib \
    -linuxfb \
    -I /home/lck/ssd20x/qt/tslib-1.15/install/include \
    -L /home/lck/ssd20x/qt/tslib-1.15/install/lib \
    -recheck-all \
    -make examples

    make -j16 
    make install

开始交叉编译:

# ./make.sh

等待一段时间后,编译完成:

设置qmake环境变量:

# vi ~/.bashrc
# export PATH=/home/ronnie/work/ssd201/qt/qt-everywhere-src-5.15.0/install/bin:$PATH

# source ~/.bashrc
# which qmake

文档更新时间: 2022-11-21 14:11   作者:Aeeditor