Files
wiki/Qt库编译-银河麒麟-RK3588.md
2024-07-15 11:46:05 +08:00

61 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# RK3588实机编译Qt5.15.13
## 目录
- [RK3588实机编译Qt5.15.13](#rk3588实机编译qt51513)
- [目录](#目录)
- [一、准备工作](#一准备工作)
- [二、编译安装](#二编译安装)
- [2.1 配置Qt(configure)](#21-配置qtconfigure)
- [2.2 编译](#22-编译)
- [2.3 安装](#23-安装)
- [附录A常见编译错误](#附录a常见编译错误)
- [1. QBasicMutex::lockInternal(int)重定义](#1-qbasicmutexlockinternalint重定义)
## 一、准备工作
- 下载Qt源码包本文以5.15.13为例如需编译其它版本下载对应版本的源代码即可注意版本不同时命令中的版本号与实际版本同步下载Qt源码包[Qt5.15.13源码链接](https://download.qt.io/archive/qt/5.15/5.15.13/single/)
- 通过以下命令行解压源代码至编译目录(需足够的磁盘空间,一般在用户目录新建)
> sudo xz -d qt-everywhere-src-5.15.13.tar.xz
> sudo tar -xvf qt-everywhere-src-5.15.13.tar
- 安装编译环境
> sudo apt-get install build-essential perl python git
- 安装依赖库
> sudo apt-get install libx11-*
> sudo apt-get install libx11*
>
> sudo apt-get install libxcb-*
> sudo apt-get install libxcb*
>
> sudo apt-get install libxkbcommon-dev
> sudo apt-get install libxkbcommon-x11-dev
> sudo apt-get install libxcb-xinerama0
> sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
## 二、编译安装
### 2.1 配置Qt(configure)
切换至解压出来的Qt目录中运行以下命令如果权限不足使用sudo执行注意其中的-prefix参数为最终Qt库的安装目录/home/firefly/Qt5.15.13),应根据实际环境进行修改,在命令行中执行修改后的命令:
> ./configure -prefix /home/firefly/Qt5.15.13 -confirm-license -opensource -release -make libs -xplatform linux-aarch64-gnu-g++ -pch -qt-libjpeg -qt-libpng -qt-zlib -no-sse2 -no-openssl -no-cups -no-glib -no-dbus -xcb -no-separate-debug-info -opengl es2 -egl -eglfs -qpa xcb -linuxfb -recheck-all -skip webengine -nomake examples -nomake tests -shared -skip purchasing -skip quick3d -skip sensors -skip speech -skip datavis3d -skip andriodextras -skip gamepad
### 2.2 编译
配置成功后,运行以下命令编译代码(-j8表示使用8线程并行编译可根据需要或实际情况修改该数值
> sudo make -j8
### 2.3 安装
编译成功后运行以下命令打包安装Qt库打包安装后的库可直接压缩后在其它同样或类似环境中解压使用
> sudo make install
## 附录A常见编译错误
### 1. QBasicMutex::lockInternal(int)重定义
- 错误描述:
> qmutex_linux.cpp:multiple definition of 'QBasicMutex::lockInternal(int)',
- 解决问题:
> As in qmutex.cpp it directly" #include qmutex_linux.cpp", as a result the content of qmutex_linux.cpp will be part of qmutex.cpp.And in the thread.pro, the SOURCES +=qmutex.cpp qmutex_linux.cpp, then during link, the two file have same symbols will be detected.When I delete qmutex_linux.cpp from SOURCES, there is no problem any more.
[参考文章](https://blog.csdn.net/qq_43417144/article/details/130680388)