linux(deepin)下编译Qt|linux(deepin)下编译Qt 5.12.0静态库

1. 下载 先下载自己QT版本对应的源码,这里我使用最新的5.12.0版本

进入链接:https://download.qt.io/archive/qt/5.12/5.12.0/single/
下载qt-everywhere-src-5.12.0.tar.xz
2. 解压
sudo tar -xvf qt-everywhere-src-5.12.0.tar.xz
3. 编译 在这里我只编译了qt的一些基本功能,具体请参考:《 linux下编译qt5.6.0静态库——configure配置》
1) 首先configure生成makefile:
./configure -static -release -nomake examples -qt-sqlite -qt-zlib -qt-libpng -qt-libjpeg -openssl-linked -no-qml-debug -opengl -qt-freetype -no-angle -nomake tests -qt-xcb -skip qtquickcontrols -skip qtquickcontrols2 -skip qtsensors -skip qtdoc -prefix /usr/local/Qt5.12.0_static
waring:应该含有 -fontconfig ,但编译始终通不过,只得尝试-qt-freetype
重要参数说明:
-static : 静态编译
-release : 只编译release版本的库
-prefix :后面跟着静态编译后的qt的存放位置
--fontconfig : 事实证明没这个gui会不能显示中文字体
期间可以看到qt各种组件的安装情况,可以根据需求再次生成想要的makefile。
接下来看到这样的提示代表configure成功。
linux(deepin)下编译Qt|linux(deepin)下编译Qt 5.12.0静态库
文章图片
configure成功结束 2)开始编译 使用以下命令进行编译,编译的时间是漫长的,这时候可以去做点其他事。
make -j4
说明:make -jn中 n指编译的线程数,n越大编译速度越快,笔者的电脑是4线程便使用4.
sudo make install
4. 配置Qt环境
打开 QT Creator ->选项,选中默认套件,点击克隆
linux(deepin)下编译Qt|linux(deepin)下编译Qt 5.12.0静态库
文章图片
克隆 第二步,选中克隆套件,点击manage:


linux(deepin)下编译Qt|linux(deepin)下编译Qt 5.12.0静态库
文章图片
manage 第三步,将编译好的qmake执行文件添加进去。
如果之前的步骤按照我的来,目录是:/usr/local/Qt5.12.0_static/bin/qmake
【linux(deepin)下编译Qt|linux(deepin)下编译Qt 5.12.0静态库】

linux(deepin)下编译Qt|linux(deepin)下编译Qt 5.12.0静态库
文章图片

    推荐阅读