3.2 KiB
RK3588实机编译Qt5.15.13
目录
一、准备工作
-
下载Qt源码包(本文以5.15.13为例,如需编译其它版本,下载对应版本的源代码即可,注意版本不同时,命令中的版本号与实际版本同步),下载Qt源码包Qt5.15.13源码链接
-
通过以下命令行解压源代码至编译目录(需足够的磁盘空间,一般在用户目录新建)
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. 参考文章