[openssl-users] Windows Compile Fails

Jay Foster jayf0ster at roadrunner.com
Fri Jun 19 21:31:23 UTC 2015


On 6/19/2015 2:09 PM, Jay Foster wrote:
> On 6/19/2015 1:11 PM, Michael Wojcik wrote:
>>> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On 
>>> Behalf
>>> Of Jay Foster
>>> Sent: Friday, June 19, 2015 15:51
>>> I got my application to compile and link.  It seemed to run OK, but 
>>> when
>>> I tried to run it on a different Windows machine, it failed with a pop
>>> up dialog complaining it could not find LIBEAY32.dll.  I 'thought' I 
>>> was
>>> statically linking this library, but apparently not.  I have no idea 
>>> how
>>> it worked on the one machine.  What is the magic incantation to get
>>> Visual Studio to statically link the OpenSSL libraries?
>> The OpenSSL libraries have to be built as static libraries.
>>
>> If you configure the OpenSSL build for static libraries, that's what 
>> you'll get.
>>
>> If you configure it for dynamic libraries, you'll get libeay32.dll 
>> and ssleay32.dll, and a pair of "import libraries" named libeay32.lib 
>> and ssleay32.lib. You won't get static libraries at all. Note the 
>> static libraries and the import libraries have the same name.
>>
>> When you link a library to a Windows executable, you provide either a 
>> static library or an import library. In the latter case, the 
>> executable will do an implicit load of the corresponding DLL at startup.
>>
>> So if you want to statically link with OpenSSL, you have to configure 
>> it for static linkage and build it that way. Then the libeay32.lib 
>> and ssleay32.lib you get should be true static libraries and not 
>> import libraries.
>>
>> I think "no-shared" is the Configure option you need. We actually 
>> have a script that changes some of the OpenSSL makefiles after 
>> configuring, so our process is a bit different from yours.
>>
> That sounds like what I'm running into.  I rebuilt the OpenSSL 
> libraries with the "no-shared" option, but this made no difference. 
> Does that work for Windows?
> Jay
> _______________________________________________
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>
I see OpenSSL build output that looks like this:

         cl /Fotmp32dll\a_sign.obj  -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 
-DOPENSSL
_THREADS  -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 
-DWIN32_L
EAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK 
-I. -DO
PENSSL_NO_IDEA -DOPENSSL_NO_RC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 
-DOPENSSL_NO_S
SL2 -DOPENSSL_NO_SSL3 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE 
-DOPENSSL_NO_STATIC_E
NGINE /Zi /Fdtmp32dll/lib -D_WINDLL  -DOPENSSL_BUILD_SHLIBCRYPTO -c 
.\crypto\asn
1\a_sign.c
a_sign.c

Should the "/MD" be "/MT"?
Is -DOPENSSL_BUILD_SHLIBCRYPTO right?
is -D_WINDLL right?

Do I need to specify enable-static-engine or no-dso?
Jay


More information about the openssl-users mailing list