How to set QSsl for static build
-
Hi, I´m still a rookie in Qt programming, also I´m not a native English speaker, so before I start I apologize for all my ignorance.
I need to deploy a Qt aplication on windows that uses QSslConfiguration library, I did a static compilation of Qt 5.3.0 based on a guide I found in this link https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW, now when I compile the application it gives me the following error:error: variable 'QSslConfiguration config' has initializer but incomplete type
QSslConfiguration config = QSslConfiguration::defaultConfiguration();
^I really need help, I´m still not familiarized with many of the conpcepts that static building involves.
-
Hi and welcome to the forums
Did you see
https://stackoverflow.com/questions/20843180/is-there-any-way-to-building-static-qt-with-static-opensslSeems you must use
-openssl-linkedwhen compiling Qt.
ps. your english is fine :)
-
Hi and welcome to the forums
Did you see
https://stackoverflow.com/questions/20843180/is-there-any-way-to-building-static-qt-with-static-opensslSeems you must use
-openssl-linkedwhen compiling Qt.
ps. your english is fine :)
@mrjj so should I pass by all the compilation process all over again? or is there any workaround, I saw the stackoverflow question but really didn´t understand where to put the -openssl-linked line
I gues that I should modify the windows-build-qt-static.ps1 script and in the next line:
cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl
-opensource -confirm-license `
-make libs -nomake tools -nomake examples -nomake tests"and replace -no-openssl by -openssl-linked, I´m I rigth?
-
@mrjj so should I pass by all the compilation process all over again? or is there any workaround, I saw the stackoverflow question but really didn´t understand where to put the -openssl-linked line
I gues that I should modify the windows-build-qt-static.ps1 script and in the next line:
cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl
-opensource -confirm-license `
-make libs -nomake tools -nomake examples -nomake tests"and replace -no-openssl by -openssl-linked, I´m I rigth?
@pjorgegerman
Hi
yes, you are right.
and also install
Win32 OpenSSL v1.0.2L
or what fits your Qt version.
Qt 5.3 is pretty old so make sure its the right ssl version. -
how do I know the right version? You mean I must download and install Win32 OpenSSL on my windows like any other program, I used the 5.3 version because I tried 5.13 and failed so I try to use the exactly same version that was used in https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
and also I have some other questions before static compile again, it´s a time comsumming process .
First, to delete the previous static build should I just simply delete the static folder, no other step needs to be done.
Second, I need to use sql in the future should I leave the script as it is,
I used a library named QtXlsx how to add it to the static compilation.
Again excuse for my ignarance, and thanks for the quick reply. -
how do I know the right version? You mean I must download and install Win32 OpenSSL on my windows like any other program, I used the 5.3 version because I tried 5.13 and failed so I try to use the exactly same version that was used in https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
and also I have some other questions before static compile again, it´s a time comsumming process .
First, to delete the previous static build should I just simply delete the static folder, no other step needs to be done.
Second, I need to use sql in the future should I leave the script as it is,
I used a library named QtXlsx how to add it to the static compilation.
Again excuse for my ignarance, and thanks for the quick reply.@pjorgegerman
Hi
https://doc.qt.io/archives/qt-5.5/build-sources.html#openssl-v1later
"From Qt version 5.2 onwards, the officially supported version for OpenSSL is 1.0.0 or later. Versions >= 0.9.7 and < 1.0.0 might work, but are not guaranteed to."So OpenSSL v1.0.2L should work.
If you have issues with compiling it, search the forum.
other have done it before.
https://forum.qt.io/topic/94328/qt-static-with-openssl-issueYes building a static version takes lots of effort. Depending on your SQL needs later, it
might also be a small fight if its not SQLLite you want to use.Its best to start clean over every time as keeping old build artifacts, more often cause issues
than speed up the process.This one QtXlsx ?
https://github.com/dbzhang800/QtXlsxWriter
If yes, then i would go with option 2
Usage(2): Use source code directly
and compiled it into the app to avoid having to build the module as static.