how to compile qt static with open ssl
-
I am trying to compile qt static with open ssl and used qt 5.12.4 but the compile failed with error feature 'openssl-linked' was enabled, but the precondition '!features.securertransport && libs.openssl' failed.
I followed the following tutorial to compile open ssl with vs2017
link textI tried to compile using
configure -static -opensource -nomake examples -opengl desktop -openssl -openssl-linked -I T:\openssl\dll\x64\release\include -L T:\openssl\dll\x64\release\lib OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32"
I attached config.log for details.
[0_1560985564414_config.log](Uploading 100%)
-
Hi,
The config log is not readable.
In any case, you should check the test logs to see why the OpenSSL related tests failed.
-
I am running win7 and I noticed the following :
giving this command runsconfigure.bat -release -opensource -confirm-license -opengl dynamic -platform win32-msvc2015 -openssl -I C:\OpenSSL\include -L c:\OpenSSL\lib -nomake examples -nomake tests -no-direct2d -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -static -static-runtime -openssl-linked
but when i add the following , i get the error message above
OPENSSL_LIBS="-LC:\OpenSSL\lib -lssl -lcrypto"
what is this? some threads state we should use this OPENSSL_LIBS="-llibeay32 -lssleay32" but i am lost and i get the same error with both.
-
I pasted the config log file here
https://pastebin.com/mNPmbGAzwhen i tried to compile an empty file, i get this
mingw32-make[1]: *** No rule to make target 'C:/Qt/Qt-5.12.4/lib/libQt5Widgets.a', needed by 'release/ssl.exe'. Stopknowing that open ssl was compiled using vs 2017 nmake. I had to compile it as lib and then as static. the parameter i gave in -i and -l was the path to the static library.
should i start from the beginning? -
What version of OpenSSL are you trying to use ?
-
1.1.1 and current master
-
i started over again and downloaded qt 5.13.0.
I can compile it with..\configure.bat -static -platform win32-g++ -release -prefix "c:\Qt\qt5.13.0_static" -opengl desktop -plugin-sql-sqlite -sql-sqlite -strip
but i want to add openssl support. how should i do it? QT 5.13.0 online installer had a check box to download openssl and it downloaded a library in C:\QT\qt5.13.0\Tools\OpenSSL\Win_x86\lib
should i use this library?
what should i add to the command line?what is the equivalent to these libraries in windows
SET OPENSSL_LIBS="/usr/${_arch}/lib/libssl.a /usr/${_arch}/lib/libcrypto.a -lws2_32 -lgdi32 -lcrypt32 -ldnsapi -liphlpapi" -
@SherifOmran
hi
https://stackoverflow.com/questions/20843180/is-there-any-way-to-building-static-qt-with-static-openssli think you also need
-openssl-linked -
i tried the following
..\configure.bat -static -platform win32-g++ -release -prefix "c:\Qt\qt5.13.0_static" -opengl desktop -plugin-sql-sqlite -sql-sqlite -strip -openssl-linked -I "C:\QT\qt5.13.0\Tools\OpenSSL\src\include" -L "C:\QT\qt5.13.0\Tools\OpenSSL\Win_x86\lib" OPENSSL_LIBS="-libcrypto -libssl"
and
..\configure.bat -static -platform win32-g++ -release -prefix "c:\Qt\qt5.13.0_static" -opengl desktop -plugin-sql-sqlite -sql-sqlite -strip -openssl-linked -I "C:\QT\qt5.13.0\Tools\OpenSSL\src\include" OPENSSL_LIBS="C:\QT\qt5.13.0\Tools\OpenSSL\Win_x86\lib\libcrypto C:\QT\qt5.13.0\Tools\OpenSSL\Win_x86\lib\libssl"
but they both fail
The sql library included here is the one downloaded from the qt online installer 1.1.1 bI also tried with static libraries produced from compiling ssl as dll for release and then with no-shared (static) but also failed at config
-
One thing I'm not sure but don't you have an option to tell which version of OpenSSL you are using ?
-
i don't have this option. The packaged version of openssl from QT Installer is 1.1.1b and gets installed under Qt\tools path. The version i was trying to install is 1.1.1c and the master branch after being compiled.
The build works without openssl linked and without the I and I parameters and OPENSSL_LIBS parameter.
I am getting puzzled. The simple question is what is -I and -L parameters and were is Qt expecting to find the header files and which libraries should i link against? -
Are you trying to build a 32 or 64 bit version of Qt ? If the later, you are using the wrong architecture for OpenSSL.
-
ooops, this could be. how can i tell make to compile the 32 bit version of qt?
i used this -platform win32-g++
how can we make sure that openssl is 32 bits and not 64? -
i compiled openssl as follows
perl configure VC-WIN64A --release --prefix=T:\openssl\dll\x64\release -openssldir=T:\openssl\ssl nmake nmake test nmake install_sw //this will copy to the dll folder and to program files/openssl/include / headers nmake clean perl configure VC-WIN64A --debug --prefix=T:\openssl\dll\x64\debug -openssldir=T:\openssl\ssl nmake nmake install_sw nmake clean //release static perl configure VC-WIN64A no-shared --release --prefix=T:\openssl\lib\x64\release -openssldir=T:\openssl\ssl nmake nmake install_sw nmake clean perl configure VC-WIN64A no-shared --debug --prefix=T:\openssl\lib\x64\debug -openssldir=T:\openssl\ssl nmake nmake install_sw nmake clean
and compile Qt with nmake using visual studio 2019
-
How are you compiling Qt ?
What setup do you do in the terminal you use for the build ? -
I downloaded Openssl 32 from the following link
and compiled qt with the following configureset OPENSSL_HOME=C:\OpenSSL-Win32 ..\configure -static -debug-and-release -platform win32-msvc2019 -static-runtime -ssl -openssl -openssl-linked -I %OPENSSL_HOME%\include -L %OPENSSL_HOME%\lib -opensource -confirm-license -opengl desktop -release -sql-sqlite -strip -qt-zlib -static-runtime -plugin-sql-sqlite -sql-sqlite -make tools -make libs -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -optimize-size -no-feature-d3d12
Notice that i did not use OPENSSL_LIBS because it keeps failing. I tried OPENSSL_LIBS="-LC:\OpenSSL-Win32\lib -lssl -lcrypto" but it failed. May be i am making it wrong !
I used Qt 5.13. The content of my make file and the contents of my config log is herenow i created a simple qml application with hello label. When i run the application i get "can not find libssl-1_1.dll, same for crypto-1_1.dll". This means it is linked dynamically. When i copy those files beside the binary it works, but i want to link it statically.
I tried many combinations. I am compiling with vs 2019 compiler ? does it make a difference if i compile the application with MinGW although Qt is compiled with nmake?
-
You either have to copy the dlls in the same folder as your application or modify the
PATH
environment in the Run part of the Project panel of Qt Creator and add the folder where they are. -
but i don't want to deliver these files to the user? my try was to create a simple file that can be delivered to the user and that i uses TLS
-
Then you have to also build OpenSSL statically.
If you want to have a 100% fully static application, you have to build all your libraries and their dependencies as static. Note that this is nothing Qt specific.
-
As far as i understand, the file i downloaded from this link has a folder called lib inside it there is static where libcrypto.lib and libssl.lib and ossl_static.pdb exist. There is also another folder called engines-3.
Assume that these libraries are statically built. how can we link it to qt to compile it using these libraries.
This command failedOPENSSL_LIBS="-LC:\OpenSSL-Win32\lib -lssl -lcrypto"
please download the file to see its content.
could you please correct it?