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
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值