从清华镜像开源站下载安装器
https://mirrors.tuna.tsinghua.edu.cn/help/qt/
执行安装
注意:清华镜像安装时会出现下载包被forbidden的问题,所以实际安装的时候换成中科大镜像
./qt-unified-linux-arm64-online.run --mirror https://mirrors.ustc.edu.cn/qtproject
安装过程
注意:
- 在选择安装组件这一步,需要选择具体的Qt版本,否则基本安装了个空壳子
- WebAssembly主要用于web允许,android也不用不到,这两个相关的可以不选择
- 其他默认就好l
编译
编译的时候报如下错误
-- The CXX compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:12 (find_package):
By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt6", but
CMake did not find one.
Could not find a package configuration file provided by "Qt6" with any of
the following names:
Qt6Config.cmake
qt6-config.cmake
Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
to a directory containing one of the above files. If "Qt6" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
原因也是如错误提示的一样,找不到cmake,
用着两个cmake名称去qt安装目录(/opt/Qt)搜索
find /opt/Qt -name "*.cmake" |grep Qt6Config.cmake
/opt/Qt/6.8.1/gcc_arm64/lib/cmake/Qt6/Qt6Config.cmake
发现cmake在如上的目录,那么修改CMakeLists.txt文件
set(CMAKE_PREFIX_PATH "/opt/Qt/6.8.1/gcc_arm64/lib/cmake/")
重新编译即可