Best way to debug OpenSSL runtime linking?
-
A QWebView I'm working with in an application won't load https links, and I suspect it's because of runtime library linking with OpenSSL.
I've built Qt on Windows with -openssl and provided the correct -I and -L flags during the build, and all went well. I've copied libeay32.dll and ssleay32.dll into the application directory, the windows\system32 directory, the windows\system directory and have even included the directory where these are originally installed to my PATH, but all to no avail.
I'd like to have a look at Qt's debug/warning messages to find out a little more, but as I'm developing on Windows, there is no stderr for runtime debug/warning messages to print. I've tried adding CONFIG+=console to my project file, using the SysInternals application DebugView which supposedly can log messages sent to stderr, and even installed my own message handler with a breakpoint set on it, and still no Qt system messages of any kind are being logged. Have I somehow set a flag that compiles these messages out?
So what is the best way to determine whether OpenSSL is being resolved at runtime? Alternatively, how can I access Qt's debug/warning log?
Many thanks for advice.
Simon Haines. -
You should run "dependency walker":http://www.dependencywalker.com/ on the target machine. It shows you, if all DLLs are available.
-
Because by default Qt links the OpenSSL libraries at runtime, there is no link-time dependency. Thus dependency walker is not useful in this situation.
What is the best way to determine whether OpenSSL is being resolved at runtime? Alternatively, how can I access Qt’s debug/warning log?
-
A browser for the debug/warning log is in the wiki article "A Browser for QDebug Log Output":http://developer.qt.nokia.com/wiki/Browser_for_QDebug_output
ssleay32.dll and libeay32.dll are the only ones that are loaded by Qt directly. In my project I do not deploy any more DLLs for SSL. Check with dependency walker, if your OpenSSL version needs more libs (special versions of the C runtime comes into mind).
You can check if SSL support is available with "QSslSocket::supportsSsl() ":http://doc.qt.nokia.com/4.7/qsslsocket.html#supportsSsl static method.
-
Thanks Volker, particularly for the debug browser link. After reading your first reply, I ran up a little test case that simply instantiated a QSslSocket and, lo and behold, somehow QT_NO_OPENSSL was defined by my configuration. I am a fool and need not have bothered you.
Looks like I need to rebuild my Qt, after checking my configure output more carefully. As I'm rebuilding anyway, I'm going to define '-openssl-linked' and fail fast if OpenSSL can't be resolved.
Thanks again for your time and advice.