当前位置:网站首页>QT static compiler (MinGW compilation)
QT static compiler (MinGW compilation)
2022-07-29 01:00:00 【I'm not Xiao Haiwa~~~~】
1. Why statically compile programs ?
By default , use QtCreator When compiling a program , Using dynamic compilation , This leads to the need to add corresponding Qt The library files , And a lot of dll file . If you want to package the generated program together with the required library into an executable program , And it can run on a computer without a development environment , Then you need to use static compilation .
2. Running environment
Windows10
QT Creator 4.11.0
QT 5.14.0 + Python 3.6 + gcc 7.3.0 + perl 5.22.1
3. Implementation steps
(1) install QT
QT5.14.0 Download address :http://download.qt.io/archive/qt/5.14/5.14.0/
Select the version shown in the figure to download

install QT when , Remember to check “Sources”
(2) install Perl
Download address :https://www.perl.org/get.html
Recommended download Strawberry Perl, Because compared with ActiveState Perl, It can be downloaded directly without registration
The installation directory :D:\SoftwareInstall\StrawberryPerl\perl
Environment variables are added automatically during installation , If you don't add , Manually add :
D:\SoftwareInstall\StrawberryPerl\perl\site\bin
D:\SoftwareInstall\StrawberryPerl\perl\bin
(3) install Python
Remember to check add during installation PATH environment variable
The installation directory :D:\SoftwareInstall\Python3.6
Environment variables are added automatically during installation , If you don't add , Manually add :
D:\SoftwareInstall\Python3.6\Scripts
D:\SoftwareInstall\Python3.6
(4) Installation environment inspection
open QT 5.14.0(MinGW 7.3.0 32-bit)
Enter the following command to check gcc Whether the compiler configuration is correct
gcc -v
Enter the following command to check perl Whether the interpreter configuration is correct
perl -v
Enter the following command to check python Whether the configuration is correct
python
Input exit() perhaps ctrl+z sign out python
(5) Configure static ratio compilation QT Information
stay D:\SoftwareInstall\Qt5.14.0\5.14.0 Create a new folder mingw73_32_static, For storing compiled files 
Switch to QT Source directory D:\SoftwareInstall\Qt5.14.0\5.14.0\Src
Enter the following command :
configure.bat -static -release -confirm-license -opensource -opengl desktop -platform win32-g++ -prefix "D:\SoftwareInstall\Qt5.14.0\5.14.0\mingw73_32_static" -sql-sqlite -sql-odbc -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -make libs -nomake tools -nomake examples -nomake tests -skip qt3d -skip qtcanvas3d -skip qtdatavis3d -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview
(6) Start compilation ( Longer time , about 3-4 Hours )
In the (5) When step configuration is completed and no error message is output , You can start compiling , In the command line window just now, enter the following command to compile :
mingw32-make
If the computer has good performance , You can use multithreading to compile :
mingw32-make -j2
ps: What we use here is 2 Threads
(7) install
After compiling , Enter the following command in the command line window just now to install :
mingw32-make install
After installation , You can do it in mingw73_32_static in , See the following :
(8) Related configuration
modify D:\SoftwareInstall\Qt5.14.0\5.14.0\mingw73_32_static\mkspecs\common\g+±win32.conf
stay conf Add... To the file QMAKE_LFLAGS = -static
stay conf Modification in file QMAKE_LFLAGS_DLL = -static

(9)QT Creator Configure the static compiler
Tools -> Options 


Clone an original , And modify the options in the red box below 
https://blog.csdn.net/gaolijing_/article/details/106822446
边栏推荐
猜你喜欢
![“index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“](/img/f2/37a1e65eb1104d72128f96fc5d9c85.png)
“index [hotel/jXLK5MTYTU-jO9WzJNob4w] already exists“

管理区解耦架构见过吗?能帮客户搞定大难题的
![Cloud function realizes website automatic check-in configuration details [web function /nodejs/cookie]](/img/e3/496247afdb3ea5b9a9cdb8afb0d41b.png)
Cloud function realizes website automatic check-in configuration details [web function /nodejs/cookie]

Hash table~
![[AD learning] the course of PCB drawing in this marine vehicle competition](/img/37/211a0557848f6922fda7a69a114923.png)
[AD learning] the course of PCB drawing in this marine vehicle competition

【目标检测】YOLOR理论简介+实践测试VisDrone数据集

Educational Codeforces Round 132 (Rated for Div. 2)【A~C】

华为发布HarmonyOS 3.0,向“万物互联”再迈一步

JWT token related configuration (global configuration identity authentication rewrites authenticate method)

Wechat campus bathroom reservation for the finished product of applet graduation design (7) mid term inspection report
随机推荐
[web development] basic knowledge of flask framework
[Commons lang3 topic] 003- randomstringutils topic
SDRAM控制器设计(数字控制器的两种设计方法)
Seven marketing strategies of NFT project
[Commons lang3 topic] 004- numberutils topic
消费行业数字化升级成“刚需”,weiit新零售SaaS为企业赋能!
What opportunities does the London gold real-time market bring?
进程和线程知识点总结 2
【愚公系列】2022年07月 Go教学课程 020-Go容器之数组
Wechat campus bathroom reservation applet graduation design finished product (8) graduation design thesis template
SQL Server 只有数据库文件,没有日志文件,恢复数据时报1813错误的解决方案
Relying on cloud business to support revenue growth alone, is Microsoft still overvalued?
Implement Lmax disruptor queue from scratch (VI) analysis of the principle of disruptor solving pseudo sharing and consumers' elegant stopping
Meeting notification & meeting feedback & feedback details function of meeting OA project
day8
What are the methods to track the real-time market of London Silver?
第二轮1000个Okaleido Tiger,再次登录Binance NFT 1小时售罄
快手重点整治搬运、洗稿等方式的养号行为,自媒体平台如何净化内容生态
PLATO上线LAAS协议Elephant Swap,用户可借此获得溢价收益
自制 | 纯手工自制一个16位RISC架构CPU