OpenSSL and Qt. Need help.
-
What's the error? Please paste the error code from build/make.
Which option do you use?
-openssl Compile in run-time OpenSSL support
or
-openssl-linked Compile in linked OpenSSL support -
Have never had troubles with Qt & openssl build.
Download openssl win32 binaries for developers from "this":http://www.slproweb.com/products/Win32OpenSSL.html site. Install it somewhere. Then, go to installation path and copy- ssleay32.dll & libaey32.dll from openssl bin folder to Qt bin folder
- libaey32.lib & ssleay32.lib(not the libaey32MD.dll or MT from lib/VC!) from openssl lib folder to Qt lib folder
- copy folder "openssl" from openssl "include" folder to Qt's "include" folder(create include folder if it is not exist)
Thats all. Simple
@configure -openssl -shared@
will work. unless you have troubles with other dependencies...If you still need help, post compiler or linker errors...
-
Well that is surprise... So you wanna to say, that building and compiling Qt with "nmake", or "mingw32" is not necessarily? But...if libs allready have, it makes sense.
I will try, and report about results.
-
sure you must build Qt after doing "configure ..." Where did you read what building is not necessarry? O_o
-
Ok, here is a results.
My system:Win 7 Home Expended x64. Using installed separately MinGW. In environment variables:
C:\Qt\4.7.4\bin;
C:\QtSDK\mingw\bin;
C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin;
C:\QtSDK-4.8\Desktop\Qt\4.8.0\msvc2010\bin;
C:\nasm;
C:\develop\tools\perl\bin;
C:\MinGW\bin;1)I've reinstall QtSDK 4.7 for MinGW and Qt-4.7.4(mingw) . In this time i don't change any parametrs in qmake.conf.
2)
@ssleay32.dll & libaey32.dll from openssl bin folder to Qt bin folder
libaey32.lib & ssleay32.lib(not the libaey32MD.dll or MT from lib/VC!) from openssl lib folder to Qt lib folder
copy folder “openssl” from openssl “include” folder to Qt’s “include” folder(create include folder if it is not exist)@
3)Run Command Promt, entering into Qt/4.7.44)configure.exe -static -debug-and-release -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libjpeg -no-crt -openssl-linked -qt-sql-odbc -no-webkit
5)Configuration was sucсessful.
6)Run mingw32-make
7)...after 4 hours of complilation, system start complaining. This has resulted the following:
@
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z18q_X509_verify_certP17x509_store_ctx_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:247: undefined reference to
X509_verify_cert'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z19q_X509_NAME_onelineP12X509_name_stPci': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:248: undefined reference to
X509_NAME_oneline'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z17q_X509_PUBKEY_getP14X509_pubkey_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:249: undefined reference to
X509_PUBKEY_get'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z17q_X509_STORE_freeP13x509_store_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:250: undefined reference to
X509_STORE_free'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z16q_X509_STORE_newv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:251: undefined reference to
X509_STORE_new'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_add_certP13x509_store_stP7x509_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:252: undefined reference to
X509_STORE_add_cert'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_CTX_freeP17x509_store_ctx_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:253: undefined reference to
X509_STORE_CTX_free'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_CTX_initP17x509_store_ctx_stP13x509_store_stP7x509_stP13stack_ st_X509': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:254: undefined reference to
X509_STORE_CTX_init'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z28q_X509_STORE_CTX_set_purposeP17x509_store_ctx_sti': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:255: undefined reference to
X509_STORE_CTX_set_purpose'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z20q_X509_STORE_CTX_newv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:256: undefined reference to
X509_STORE_CTX_new'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z35q_OPENSSL_add_all_algorithms_noconfv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:263: undefined reference to
OPENSSL_add_all_algorithms_noconf'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z33q_OPENSSL_add_all_algorithms_confv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:264: undefined reference to
OPENSSL_add_all_algorithms_conf'
collect2: Р?С<РїР?Р>Р?РчР?РёРч ld Р·Р°Р?РчС?С?РёР>Р?С?С? С? РєР?Р?Р?Р? Р?Р?Р·Р?С
?Р°С'Р° 1
mingw32-make[5]: *** [........\bin\assistant.exe] Error 1
mingw32-make[5]: Leaving directoryC:/Qt/4.7.4-fresh/tools/assistant/tools/assi stant' mingw32-make[4]: *** [debug-all] Error 2 mingw32-make[4]: Leaving directory
C:/Qt/4.7.4-fresh/tools/assistant/tools/assi
stant'
mingw32-make[3]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[3]: Leaving directoryC:/Qt/4.7.4-fresh/tools/assistant/tools' mingw32-make[2]: *** [sub-tools-make_default-ordered] Error 2 mingw32-make[2]: Leaving directory
C:/Qt/4.7.4-fresh/tools/assistant'
mingw32-make[1]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.7.4-fresh/tools'
mingw32-make: *** [sub-tools-make_default-ordered] Error 2C:\Qt\4.7.4-fresh>
@ -
8)When compilation is finished, i run "mingw32-make install". The result is symmetric with the previous item:
@
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z16q_X509_STORE_newv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:251: undefined reference to
X509_STORE_new'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_add_certP13x509_store_stP7x509_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:252: undefined reference to
X509_STORE_add_cert'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_CTX_freeP17x509_store_ctx_st': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:253: undefined reference to
X509_STORE_CTX_free'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_CTX_initP17x509_store_ctx_stP13x509_store_stP7x509_stP13stack_ st_X509': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:254: undefined reference to
X509_STORE_CTX_init'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z28q_X509_STORE_CTX_set_purposeP17x509_store_ctx_sti': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:255: undefined reference to
X509_STORE_CTX_set_purpose'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z20q_X509_STORE_CTX_newv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:256: undefined reference to
X509_STORE_CTX_new'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z35q_OPENSSL_add_all_algorithms_noconfv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:263: undefined reference to
OPENSSL_add_all_algorithms_noconf'
c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z33q_OPENSSL_add_all_algorithms_confv': C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:264: undefined reference to
OPENSSL_add_all_algorithms_conf'
collect2: Р?С<РїР?Р>Р?РчР?РёРч ld Р·Р°Р?РчС?С?РёР>Р?С?С? С? РєР?Р?Р?Р? Р?Р?Р·Р?С
?Р°С'Р° 1
mingw32-make[5]: *** [........\bin\assistant.exe] Error 1
mingw32-make[5]: Leaving directoryC:/Qt/4.7.4-fresh/tools/assistant/tools/assi stant' mingw32-make[4]: *** [debug-all] Error 2 mingw32-make[4]: Leaving directory
C:/Qt/4.7.4-fresh/tools/assistant/tools/assi
stant'
mingw32-make[3]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[3]: Leaving directoryC:/Qt/4.7.4-fresh/tools/assistant/tools' mingw32-make[2]: *** [sub-tools-make_default-ordered] Error 2 mingw32-make[2]: Leaving directory
C:/Qt/4.7.4-fresh/tools/assistant'
mingw32-make[1]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.7.4-fresh/tools'
mingw32-make: *** [sub-tools-make_default-ordered] Error 2C:\Qt\4.7.4-fresh>
@After all of this operations, i noticed incorrect path in system enviroment variables. So varibles was changed:
C:\Qt\4.7.4-fresh\bin;
C:\QtSDK-4.8\Desktop\Qt\4.8.0\msvc2010\bin;
C:\nasm;
C:\develop\tools\perl\bin;
C:\MinGW\bin;"mingw32-make" and "mingw32 install" was rerun. I this time compilation took much less time, but result is same.
What goes wrong? Can it causes by separately MinGW?
-
Also tried use some function from openssl. Output after compilation by Qt MinGW and separately MinGW contains about 100 errors same type.
Here is some output Qt MinGW:
@
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:240: undefined reference toX509_EXTENSION_get_object' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z11q_X509_freeP7x509_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:241: undefined reference toX509_free' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z14q_X509_get_extP7x509_sti':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:242: undefined reference toX509_get_ext' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z20q_X509_get_ext_countP7x509_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:243: undefined reference toX509_get_ext_count' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z18q_X509_get_ext_d2iP7x509_stiPiS1_':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:244: undefined reference toX509_get_ext_d2i' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z22q_X509_get_issuer_nameP7x509_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:245: undefined reference toX509_get_issuer_name' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z23q_X509_get_subject_nameP7x509_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:246: undefined reference toX509_get_subject_name' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z18q_X509_verify_certP17x509_store_ctx_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:247: undefined reference toX509_verify_cert' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z19q_X509_NAME_onelineP12X509_name_stPci':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:248: undefined reference toX509_NAME_oneline' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z17q_X509_PUBKEY_getP14X509_pubkey_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:249: undefined reference toX509_PUBKEY_get' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z17q_X509_STORE_freeP13x509_store_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:250: undefined reference toX509_STORE_free' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z16q_X509_STORE_newv':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:251: undefined reference toX509_STORE_new' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_add_certP13x509_store_stP7x509_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:252: undefined reference toX509_STORE_add_cert' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_CTX_freeP17x509_store_ctx_st':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:253: undefined reference toX509_STORE_CTX_free' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z21q_X509_STORE_CTX_initP17x509_store_ctx_stP13x509_store_stP7x509_stP13stack_st_X509':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:254: undefined reference toX509_STORE_CTX_init' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z28q_X509_STORE_CTX_set_purposeP17x509_store_ctx_sti':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:255: undefined reference toX509_STORE_CTX_set_purpose' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z20q_X509_STORE_CTX_newv':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:256: undefined reference toX509_STORE_CTX_new' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z35q_OPENSSL_add_all_algorithms_noconfv':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:263: undefined reference toOPENSSL_add_all_algorithms_noconf' c:\Qt\4.7.4-fresh\lib/libQtNetworkd.a(qsslsocket_openssl_symbols.o): In function
Z33q_OPENSSL_add_all_algorithms_confv':
C:\Qt\4.7.4-fresh\src\network/ssl/qsslsocket_openssl_symbols.cpp:264: undefined reference toOPENSSL_add_all_algorithms_conf' collect2: выполнение ld завершилось с кодом возврата 1 mingw32-make[1]: Leaving directory
C:/Users/House15/Documents/QtProjects/Server-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK________'
mingw32-make[1]: *** [debug\DialogTcpServer.exe] Error 1
mingw32-make: *** [debug] Error 2
@Output separately MinGW is pretty same.
-
Most important!
After all of the above, i added
@
#include <openssl/evp.h>
...
unsigned char key[32];
unsigned char iv[8];
unsigned char inbuf[BUFSIZE], outbuf[BUFSIZE];
EVP_CIPHER_CTX *ctx;
const EVP_CIPHER * cipher;
...ctx=new EVP_CIPHER_CTX; EVP_CIPHER_CTX_init(ctx); cipher = EVP_aes_256_cfb(); EVP_EncryptInit(ctx, cipher, key, iv);
@
System starting complaining, which confused me at the very beginning of my acquaintance with OpenSSL.
@
C:\Users\House15\Documents\QtProjects\Server-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK________/../Server/myserver.cpp:142: undefined reference toEVP_CIPHER_CTX_init' C:\Users\House15\Documents\QtProjects\Server-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK_________/../Server/myserver.cpp:144: undefined reference to
EVP_aes_256_cfb128'
C:\Users\House15\Documents\QtProjects\Server-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK________/../Server/myserver.cpp:148: undefined reference toEVP_EncryptInit' C:\Users\House15\Documents\QtProjects\Server-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK_________/../Server/myserver.cpp:142: undefined reference to
EVP_CIPHER_CTX_init'
C:\Users\House15\Documents\QtProjects\Server-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK________/../Server/myserver.cpp:144: undefined reference toEVP_aes_256_cfb128' C:\Users\House15\Documents\QtProjects\Server-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK_________/../Server/myserver.cpp:148: undefined reference to
EVP_EncryptInit'
@And that it's all about! I need OpenSSL only for this fuctions, and maybe another, for implementation AES.
-
Ok, guess i've solve the problem.
In general, problem is reduced to question:Why system doesn't see references of function in libs. If we work with downloaded from somewhere .lib and .dll files, it's obvios - problem in them. So, the is two possible solution:
1)Download another libs, and try again.
2)Build up libs by yourself.Frankly, i'm simple just downloaded another libs, and it's finally started to work! But, there is one thing:if you x64 system, you can faced with the problem:Qt was build for x86 architecture. Even if you rebuild it with 64-bits compiler, not all libs will be fit for new environment.
Solution:build up libs from source. I'm did it, and it's finally start to see OpenSSL functions.
One thing, nevertheless, is disturb: program have a difficulties with working with files. It's can write into them, but cannot read from it. I can not say for sure whether this is due to the recompiling, but problem with OpenSSL was solved.
-
Here is my spoon of tar...
In attempt read of file, in debuger i can see this:
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\qt-everywhere-opensource-src-4.8.1\bin\LIBEAY32.dll -
*** ERROR: Module load completed but symbols could not be loaded for C:\Windows\system32\odbcint.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\qt-everywhere-opensource-src-4.8.1\bin\SSLEAY32.dll -
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\system32\nvinitx.dll -Try recompile all of things on x86
-
Hi All,
- We are working on Qt Fancybrowser application. In that https websites are not loading
- Qt geeks and web search basis , they suggests that
By default, the OpenSSL support will be disabled in the Qt SDK. So we have to build the Qt SDK with OpenSSL support and compile the fancy browser source in that SDK will solve this problem - So we did the following steps
====================================================
a. Downloaded the "qt-everywhere-opensource-src-4.8.4.tar.gz"b. ./configure -embedded arm -xplatform qws/linux-arm-g++ -qt-kbd-linuxinput -qt-kbd-qvfb -qt-mouse-tslib -webkit -openssl -opensource -verbose -R /usr/local/tslib/lib/ -L/usr/local/ssl/lib/ -I/usr/local/ssl/include/
c. make
d. make install
e. After this the Qt SDK is installed in /usr/local/Trolltech/Qt-Embedded-4.8.4/
f. We set QT SDK path as qmake path in the above compiled and tested the bonary in our board
=====================================================
4. Now also we are having the same issuePlease let us know the root cause and is there any mistakes we are doing. Please help to resolve this problem
Regards,
Vignesh