QT 交叉 编译问题整理( ing )

解压缩

tar -vxf qt-everywhere-src-5.12.4.tar.xz
cd qt-everywhere-src-5.12.4

修改 qmake 版本

/etc/profile

/Qt5.12.4/5.12.4/gcc_64/bin:$PATH

// 创建文件 设置权限

touch autoConfigure.sh
chmod 777 autoConfigure.sh

// 编辑文件

gedit autoConfigure.sh

// 加入内容
-prefix是安装目录;
-xplatform是arm编译器类型,在qtbase/mkspecs目录下,根据自己交叉编译工具进行相应的替换



配置 指令 备用

  1. ./configure -prefix ~/Qt5.12.4 -confirm-license -opensource -static -release -xplatform linux-arm-gnueabi-g++ -qt-libjpeg -no-xcb
    -no-largefile -no-accessibility -no-sse2 -nomake tests -nomake examples -nomake tools -no-openssl -no-nis -no-cups -no-dbus -no-sql-sqlite -skip qt3d -skip qtactiveqt -sk ip qtandroidextras -skip qtcanvas3d -skip qtcharts
    -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdo c -skip qtgamepad

./configure
-prefix ~/Qt5.12.4 \
-release \
-opensource \
-xplatform
linux-arm-gnueabi-g++ \
-make libs \
-optimized-qmake
-no-opengl \
-no-sse2 \
-no-openssl \
-no-cups \
-no-glib
-no-pkg-config \
-no-separate-debug-info \
-pch \
-shared
-qt-libjpeg \
-qt-zlib \
-qt-libpng

  1. ./configure -v
    -opensource -confirm-license
    -prefix -~/Qt5.12.4
    -device linux-imx6-g++
    -device-option CROSS_COMPILE=${CROSS_COMPILE}
    -sysroot ${SDKTARGETSYSROOT}
    -I ${SDKTARGETSYSROOT}/usr/include
    -L ${SDKTARGETSYSROOT}/usr/lib
    -no-pch -pkg-config -release -shared -make libs
    -linuxfb -gstreamer -no-pulseaudio -no-webengine-pulseaudio
    -xcb -xcb-xlib -no-eglfs
    -qpa xcb
    -nomake examples -nomake tests
    -opengl es2 \

选择 armv7-a
/qt-everywhere-src-5.12.4/qtbase/mkspecs/linux-arn-gnueabi-g++ 目录下
qmake.conf 文件
目录 与 xplatform 配置相关

#
# qmake configuration for building with arm-linux-gnueabi-g++
#
 
MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib
 
QT_QPA_DEFAULT_PLATFORM = linux #eglfs
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
 
 
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
 
# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabi-gcc
QMAKE_CXX               = arm-linux-gnueabi-g++
QMAKE_LINK              = arm-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabi-g++
 
# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabi-objcopy
QMAKE_NM                = arm-linux-gnueabi-nm -P
QMAKE_STRIP             = arm-linux-gnueabi-strip
load(qt_config)

// 执行脚本
./autoConfigure.sh

// make

qmake
make -j8

错误统计

/home/hello/qt-everywhere-opensource-src-5.4.0/qtbase/src'
make[1]: *** [sub-src-make_first] 错误 2
make[1]:正在离开目录
/home/hello/qt-everywhere-opensource-src-5.4.0/qtbase'
make: *** [module-qtbase-make_first] 错误 2
主要原因是它依赖的dbus目录没有编译,解决方法如下:
#cd /home/hello/qt-everywhere-opensource-src-5.4.0/qtbase/src/dbus执行下面的
如没有Makefile,执行下面的命令
#../../bin/qmake dbus.pro
然后执行Make.
#make
编译成功后,再切换到/home/hello/qt-everywhere-opensource-src-5.4.0目录下,执行
#make

你可能感兴趣的:(QT,QT_arm)