Is there any way to building static Qt with static OpenSSL?

后端 未结 4 726
粉色の甜心
粉色の甜心 2020-11-29 11:58

Original question was slightly different but part of a more major question.

I am trying to build Qt 5.2 as static with static OpenSSL on Windows.

My final g

4条回答
  •  渐次进展
    2020-11-29 12:35

    This is how I build Qt 5.7.1 with SSL support on Windows using MSVC 2013:

    • Download and install: Perl version 5.12 or later
    • Download and install: Python version 2.7 or later
    • Download and install: Ruby version 1.9.3 or later

    Make sure Perl, Python and Ruby can be found in the PATH environment variable.

    • Download and install: Win32 OpenSSL v1.0.2L

    Download Qt from the github repository:

    cd C:\Qt
    git clone https://github.com/qt/qt5.git
    cd C:\Qt\qt5 
    git checkout 5.7 
    

    Make sure to checkout commit 36e7cff94fbb4af5d8de6739e66164c6e6873586. At this time, checking out 5.7 does exactly that.

    Place the contents below in qt5vars.bat located at C:\Qt\qt5. Make adjustments if you need to:

    @echo off
    
    REM Set up \Microsoft Visual Studio 2015, where  is \c amd64, \c x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
    
    REM Edit this location to point to the source code of Qt
    SET _ROOT=C:\Qt\qt5
    
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    
    REM Uncomment the below line when using a git checkout of the source repository
    SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    
    REM Uncomment the below line when building with OpenSSL enabled. If so, make sure the directory points
    REM to the correct location (binaries for OpenSSL).
    SET PATH=C:\OpenSSL-Win32\bin;%PATH%
    
    REM When compiling with ICU, uncomment the lines below and change  appropriately:
    REM SET INCLUDE=\include;%INCLUDE%
    REM SET LIB=\lib;%LIB%
    REM SET PATH=\lib;%PATH%
    
    REM Contrary to earlier recommendations, do NOT set QMAKESPEC.
    
    SET _ROOT=
    
    REM Keeps the command line open when this script is run.
    cmd /k
    

    After that, execute this file and properly initiate the repository:

    qt5vars.bat 
    perl init-repository
    

    Finally, to configure and compile the library successfully (with debug and release versions), make sure the paths referenced by configure are also valid on your system:

    configure -static -static-runtime -debug-and-release -ssl -openssl -openssl-linked -opengl dynamic -platform win32-msvc2013 -prefix C:\Qt\qt5.7-msvc2013-static -nomake tests -nomake examples -I "C:\OpenSSL-Win32\include" -L "C:\OpenSSL-Win32\lib\VC\static" OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32 -lCrypt32" OPENSSL_LIBS_DEBUG="-lssleay32MTd -llibeay32MTd" OPENSSL_LIBS_RELEASE="-lssleay32MT -llibeay32MT"
    nmake
    nmake install
    

    Everything so far should have run smoothly and beautifully. Now it's a matter of configuring Qt Creator to detect this new Qt Version and create a new Kit use on your projects:

提交回复
热议问题