Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1876|回复: 3
打印 上一主题 下一主题

qt源码及编译相关问题

[复制链接]

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
跳转到指定楼层
楼主
发表于 2020-3-15 20:57:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Qter 于 2020-3-21 11:26 编辑

https://code.qt.io/cgit/


https://doc.qt.io/qt-5/build-sources.html

General Installation Information
Building Qt revolves around using configure to configure Qt for a particular platform with a particular set of Qt features or modules. For more information, visit the following page:

configure 相关在源码根目录下运行 configure -h 查看相关命令,前提是在init-repository后,已经存在qtbase目录
注:windows平台configure对应是是configure.bat这个文件
mkdir qtbuild
cd qtbuild

configure -prefix "%LibrariesPath%\Qt-5.12.5
-prefix 指定编译后Qt程序和相关库的安装路径



-platform 设置编译主机平台.
常用如下:
configure.bat -platform win32-g++
configure.bat -platform win32-msvc

完整的列表查看qtbase/mkspecs 目录
  • -device - a specific device or chipsets. The list of devices that configure is compatible with are found in qtbase/mkspecs/devices. For more information, visit the [url=http://wiki.qt.io/Categoryevices]Devices[/url] Wiki page.


-mp .................. Use multiple processors for compilation (MSVC only)
-opensource .......... Build the Open-Source Edition of Qt


https://doc.qt.io/qt-5/windows-building.html
https://doc.qt.io/qt-5/windows-requirements.html

编译要求
Libraries
  • OpenSSL Toolkit: Qt can make use of OpenSSL to support Secure Socket Layer (SSL) communication.
  • ICU: Qt 5 can make use of the ICU library for enhanced UNICODE and Globalization support (see QTextCodec, QCollator::setNumericMode()).
    At compile time, the include and lib folders of the ICU installation must be appended to the INCLUDE and LIB environment variables. At run-time, the ICU DLLs need to be found by copying the DLLs to the application folder or by adding the bin folder of the ICU installation to the PATH environment variable.
  • ANGLE: This library converts OpenGL ES 2.0 API calls to DirectX 11 or DirectX 9 calls (depending on availability), removing the need to install graphics drivers on the target machines.
编译用到的工具

  • ActivePerl - Install a recent version of ActivePerl (download page) and add the installation location to your PATH.
  • Python - Install Python from the here and add the installation location to your PATH.



动手先添加下依赖的PATH路径
D:\TBuild\ThirdParty\Perl\bin;D:\TBuild\ThirdParty\Python27;D:\TBuild\ThirdParty\jom;

在桌面上创建打开的快捷方式
右键->新建->快捷方式,输入如下内容
%SystemRoot%\system32\cmd.exe /E:ON /V:ON /k F:\Qt\qt5vars.cmd

qt5vars.cmd内容如下:
  1. REM Set up Microsoft Visual Studio 2019, where <arch> is amd64, x86, etc.
  2. CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat" x86
  3. SET _ROOT=F:\Qt\Qt-5
  4. SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
  5. SET _ROOT=
复制代码
https://doc.qt.io/qt-5/windows-deployment.html

C:\Qt\Qt5.12.0\5.12.0\msvc2017\bin\windeployqt.exe  查看qt程序的依赖文件

Static Linking
configure -static


重新配置和重建Qt 要输入如下命令,对原来的配置进行清理
nmake distclean


对Qt开发的程序的静态编译和动态编译
nmake clean
qmake -config release
nmake

https://wiki.qt.io/Building_Qt_5_from_Git

This article provides hints for checking out and building the Qt 5 repositories. This is primarily for developers who want to contribute to the Qt library itself, or who want to try the latest unreleased code.
If you simply want to build a specific release of Qt from source to use the libraries in your own project, you can download the source code from the Official Releases page or the Archive. Alternatively, commercial customers can download the Source Packages via the Qt Account portal.


To compile Qt Creator, see Building Qt Creator from Git.

All desktop platforms
  • Git (>= 1.6.x)
  • Perl (>=5.14)
  • Python (>=2.6.x)
  • A working C++ compiler


回复

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
沙发
 楼主| 发表于 2020-3-21 08:53:45 | 只看该作者
本帖最后由 Qter 于 2020-3-21 09:05 编辑

基于官方源码库qt_5_12_5 https://code.qt.io/cgit/的编译

以根目录为 F:\qtbuild
先下载编译依赖库openssl
  1. git clone https://github.com/openssl/openssl.git openssl_1_1_1
  2. cd openssl_1_1_1
  3. git checkout OpenSSL_1_1_1-stable
  4. perl Configure no-shared debug-VC-WIN32
  5. nmake
  6. mkdir out32.dbg
  7. move libcrypto.lib out32.dbg
  8. move libssl.lib out32.dbg
  9. move ossl_static.pdb out32.dbg\ossl_static
  10. nmake clean
  11. move out32.dbg\ossl_static out32.dbg\ossl_static.pdb
  12. perl Configure no-shared VC-WIN32
  13. nmake
  14. mkdir out32
  15. move libcrypto.lib out32
  16. move libssl.lib out32
  17. move ossl_static.pdb out32
  18. cd ..
复制代码
下载qt编译
  1. git clone git://code.qt.io/qt/qt5.git qt_5_12_5
  2. cd qt_5_12_5
  3. perl init-repository --module-subset=qtbase,qtimageformats
  4. git checkout v5.12.5
  5. git submodule update qtbase
  6. git submodule update qtimageformats
  7. cd qtbase
  8. git apply ../../patches/qtbase_5_12_5.diff
  9. cd ..

  10. configure -prefix "%LibrariesPath%\Qt-5.12.5" -debug-and-release -force-debug-info -opensource -confirm-license -static -static-runtime -I "%LibrariesPath%\openssl_1_1_1\include" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%LibrariesPath%\openssl_1_1_1\out32.dbg\libssl.lib %LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" OPENSSL_LIBS_RELEASE="%LibrariesPath%\openssl_1_1_1\out32\libssl.lib %LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" -mp -nomake examples -nomake tests -platform win32-msvc

  11. jom -j4
  12. jom -j4 install
  13. cd ..
复制代码
回复 支持 反对

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
板凳
 楼主| 发表于 2020-3-21 14:01:43 | 只看该作者

F:\qtbuild_github\qt_5_12_5>which link
/usr/bin/link
回复 支持 反对

使用道具 举报

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
地板
 楼主| 发表于 2020-3-22 17:32:14 | 只看该作者
ERROR: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && libs.openssl' failed.

删除目录下的config.cache
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-6 03:13 , Processed in 0.059150 second(s), 18 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表