[SOLVED] QNetworkAccessManager crash related to SSL
-
My Qt Windows desktop application crashes on first QNetworkAccessManager->get call. I get following error in the log.
@Auto configuration failed
16100:error:02001015:system library:fopen:Is a directory:.\crypto\bio\bss_file.c:122:fopen('d:/openssl/ssl/openssl.cnf','rb')
16100:error:2006D002:BIO routines:BIO_new_file:system lib:.\crypto\bio\bss_file.c:127:
16100:error:0E078002:configuration file routines:DEF_LOAD:system lib:.\crypto\conf\conf_def.c:199@It is something related to OpenSSL configuration, but I actually don't use (and don't need) SSL in my application. I know that OpenSSL library is loaded together with QNetworkAccessManager, but is there any way to disable it?
I can fix this problem by reinstalling openssl libraries like it is stated here ( http://stackoverflow.com/questions/13526389/qt-webkit-widget-error ), but this is not a good solution since I cannot force my customers to reinstall openssl on their systems because of my application. So I am looking for a better solution. I already tried adding DEFINES += QT_NO_SSL into my project file but with no luck. Interesting here is that this is only happening after I deploy my application, it works smoothly from Qt Creator.
Important thing here is that I can manually manipulate crashing (on deploy systems) by modifying OPENSSL_CONF environment variable. If it does not exist or if it is set correctly, app won't crash, otherwise (env. variable is set to incorrect folder) app crashes.
Any ideas?
-
[quote author="frano_ri" date="1421410242"]
It is something related to OpenSSL configuration, but I actually don't use (and don't need) SSL in my application. I know that OpenSSL library is loaded together with QNetworkAccessManager, but is there any way to disable it?
[/quote]You need to recompile Qt without OpenSSL support then. The official Qt deliveries are built with OpenSSL support enabled by default.
[quote author="frano_ri" date="1421410242"]
I already tried adding DEFINES += QT_NO_SSL into my project file but with no luck. Interesting here is that this is only happening after I deploy my application, it works smoothly from Qt Creator.
[/quote]This won't work, since in you project file you only set the DEFINES for you project, but it won't affect how Qt was built (see first comment).
[quote author="frano_ri" date="1421410242"]--
Important thing here is that I can manually manipulate crashing (on deploy systems) by modifying OPENSSL_CONF environment variable. If it does not exist or if it is set correctly, app won't crash, otherwise (env. variable is set to incorrect folder) app crashes.
[/quote]Nothing you can do to a misconfigurated system.
-
[quote author="frano_ri" date="1421416101"]Ok, thanks a lot! But, how should I recompile Qt without OpenSSL?
[/quote]
see "this":http://qt-project.org/wiki/Building_Qt_5_from_Git and "this":http://doc.qt.io/qt-5/ssl.html#enabling-and-disabling-ssl-supportMake sure you call Qt's configure with the "-no-openssl" option
[quote author="frano_ri" date="1421416101"]
And why it does not crash when I run it directly from Qt Creator?[/quote]On the same machine?
-
[quote author="raven-worx" date="1421417877"][quote author="frano_ri" date="1421416101"]Ok, thanks a lot! But, how should I recompile Qt without OpenSSL?
[/quote]
see "this":http://qt-project.org/wiki/Building_Qt_5_from_Git and "this":http://doc.qt.io/qt-5/ssl.html#enabling-and-disabling-ssl-supportMake sure you call Qt's configure with the "-no-openssl" option
[/quote]
Thanks, I'll try that.[quote author="raven-worx" date="1421417877"]
[quote author="frano_ri" date="1421416101"]
And why it does not crash when I run it directly from Qt Creator?[/quote]On the same machine?
[/quote]Yes, on the same machine, that's strange. Is it possible that Qt is correctly compiled then, but I miss something on deployment?
-
recompiling without OpenSSL support is the safest way since you do not need it anyway.
QtCreator is also capable of using it's own environmental variables when starting the application out of it. You can check it in QtCreator's project settings under "Build Environment" for the kit you use to build (in the "Project" section in the toolbar on the left side)