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

相关文章

显卡天梯图2024最新版,显卡是电脑进行图形处理的重要设备,...
初始化电脑时出现问题怎么办,可以使用win系统的安装介质,连...
todesk远程开机怎么设置,两台电脑要在同一局域网内,然后需...
油猴谷歌插件怎么安装,可以通过谷歌应用商店进行安装,需要...
虚拟内存这个名词想必很多人都听说过,我们在使用电脑的时候...