Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
741 views
in Technique[技术] by (71.8m points)

static - about compiling openssl inside qt application

I have Qt 4.8.4 (default installation) with MSVC. In my application I'm using ssl connection to the server. QtNetworkd4.dll requires runtime libeay32.dll and ssleay32.dll If I put these libs inside my app directory everything works fine.

I was trying to compile openssl libs statically into my application, although compilation goes fine, during startup application complains about unresolved symbols until I place libeay32.dll and ssleay32.dll into application folder.

So question is: Is it true, that compiling these libs into my application is useless, because QtNetwordkd4.dll will not look for needed functions/symbols inside my application binary, and I should rather compile entire Qt with openssl built in? Like this:

configure -openssl -I C:OpenSSL-Win32include -L C:OpenSSL-Win32libVCstatic

Or what I'm trying to do is actually doable, and I've just done something wrong, like wrong version of libeay32 and ssleay32, etc. ?

I'm trying to compile with static openssl for two reasons

  1. I wouldn't have to place libeay32 and ssleay32 inside my app dir
  2. I'm afraid that on some machines there can be openssl already installed in different version, and my app will interact with these libs from system directories.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try like this:

-openssl -openssl-linked -I C:OpenSSL-Win32include -L C:OpenSSL-Win32libVCstatic  OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...