[开发|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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)