微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

[开发|C++] 在deepinV20.6系统下编译Qt-creator4.13

系统环境说明

系统:Deepin V20.6
平台:amd64
GCC版本:8.3.0
Clang版本:13.0.1
Qt版本:5.12.3
qmake版本:3.1

编译工具安装

sudo apt install cmake

编译工具安装

  1. 编译安装llvm
    deepinV20.6编译安装llvm8.x
  2. 编译安装Qt
    在deepinV20.6编译安装Qt5.12.3

迁出源代码

git clone https://gitee.com/mirrors/qt-creator.git

编译

cd /path/to/qt-creator
# 切换4.13分支
git checkout 4.13
mkdir build
cd build
cmake \
  -D CMAKE_BUILD_TYPE=Release \
  -D PYTHON_EXECUTABLE=/bin/python3 \
  -D CMAKE_INSTALL_PREFIX=~/App/Qt-creator4.13 \
  ..
cmake --build . --target install

配置环境变量

echo "export PATH=~/App/Qt-creator4.13/bin:\$PATH" >> ~/.bashrc

测试

source ~/.bashrc
#qmake --version

常见错误处理

  1. 编译报如下错误
  Could not find a package configuration file provided by "Qt5Qml" with any                                                                                               
  of the following names:                                                                                                                                                 
                                                                                                                                                                          
    Qt5QmlConfig.cmake                                                                                                                                                    
    qt5qml-config.cmake 

解决方

cd /path/to/qt-everywhere-src-5.12.3/qtdeclarative
qmake .
make -j8
make install
  1. 编译报如下错误
No python3 interpreter found, skipping extraction of data from XML and JSON                                                                                             
  files.                                                                                                                                                                  
                                                                                                                                                                          
   *** Please pass -DPYTHON_EXECUTABLE=/path/to/python3 to cmake. 

解决方
提示添加 -D PYTHON_EXECUTABLE=/bin/python3参数

  1. 编译报如下错误
 Failed to find Qt5 component "LinguistTools" config file at                                                                                                             
  "/home/dev/App/qt5.12.3/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake" 

解决方

cd /path/to/qt-everywhere-src-5.12.3/qttools
qmake .
make -j8
make install

原文地址:https://www.jb51.cc/wenti/3279597.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐