当前位置: 首页> 汽车> 维修 > QT5.12环境搭建与源码编译

QT5.12环境搭建与源码编译

时间:2025/8/25 21:43:54来源:https://blog.csdn.net/u010823818/article/details/140170782 浏览次数: 0次

一、概述
        QT版本:QT5.12.10
        Qt网址:http://download.qt.io/archive/qt/
        编译平台 ubuntu18.04


二、安装交叉编译工具链
1、获取交叉编译工具链 
        一般如果是编译系统如果有对应的gcc 就是用这个就可以了 比如rk3128 linux在rk312x-linux-no-sync-hyperlcd\prebuilts\gcc\linux-x86,分为aarch64和arm,如果没有的话 就是用下面的指令下载gcc并安装

        交叉工具链:gcc-4.9.3-64-gnu.tar.gz

2、安装交叉工具链

 tar zxvf gcc-4.9.3-64-gnu.tar.gz  -C  /

命令执行后,在系统 /opt 目录下会有:gcc-4.9.3-64-gnu

三、QT5.12.10 源码编译

1、编译准备
       一般只需要qt-everywhere,获取下载并解压出来

如果根目录里面有.sh 直接修改即可 没有.sh的话 重建一个run.sh,并输入如下内容

大致内容如下 关于第一句./configure -extprefix /opt/aarch64_qt5.12 是表示最后结果会存在这个位置

二、配置编译模块
如arm64位
./configure -extprefix /opt/aarch64_qt5.12 \
-opensource -confirm-license \
-release \
-strip \
-shared \
-xplatform linux-aarch64-gnu-g++ \
-make examples \
-nomake tools \
-nomake tests \
-widgets \
-dbus-runtime \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
--xcb=no \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-gif \
-ico \
-recheck-all如32位
./configure -extprefix /opt/arm_qt5.12 \
-opensource -confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-make examples \
-nomake tools \
-nomake tests \
-widgets \
-dbus-runtime \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
--xcb=no \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-gif \
-ico \
-recheck-all
2、开始编译

命令1: ./run.sh 备注:配置时会提示Do you accept the terms of either license? 选择 y 即可
命令2: make
命令3: make install

备注1:

如果出现以下错误'.ROR: Invalid command line parameter '
./myautoconfigure.sh: 2: -opensource: not found
./myautoconfigure.sh: 3: -confirm-license: not found那么原因是这个文件是 DOS 格式的,需要转换为 unix 格式。vi myautoconfigure.sh 然后 set ff = unix
(注意:这个问题在由windows 系统传向 linux 系统的shell 文件(.sh)经常出现。)

备注2 :

make 时间会比较长,需要耐心等待。
make install 后,会生成一个目录,在/opt/aarch64_qt5.12 

如果编译没有出错,成功生成aarch64_qt5.12 ,至此Qt源码编译完成。aarch64_qt5.12 会在下边qtcreator配置时会用到。

关键字:QT5.12环境搭建与源码编译

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: