[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#5603) Linking OpenSSL on Windows requires libgdi32 and libws2_32 after libcrypto

Full_Name: Ben Schmidt
Version: 2.4.10
OS: MinGW32, Mac OS X
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

My precise situation is, I am sure, a very uncommon scenario. However, it may
affect other building methods as well, and an appropriate fix I am sure could
help a few users.

Here's what I have been doing (please try not to laugh!): I have been
cross-compiling OpenLDAP on Mac OS X for MinGW32, including the SQL backend. I
have found two issues related to the configuration/build process.

I am afraid I really have no knowledge of GNU autoconf, so I will describe the
problem and my fixes, but with no pretense that they are appropriate for
applying to the code. I will suggest an appropriate way to fix it, but will have
to leave that work to another developer.

This is the second.

When linking OpenSSL on Windows, it is also necessary to link against libgdi32
and libws2_32 needs to be linked after libcrypto.

I worked around the problem with a simple substitution in configure:

s/-lcrypto/-lcrypto -lgdi32 -lws2_32

A more appropriate fix would be to make configure test first without these extra
libraries, and then with them, so that they are included if needed.

Note that configure will not fail if -lws2_32 is omitted, but building libldap
and libldap_r will fail later. I think it is probably safe to assume that if
-lgdi32 is needed, -lws2_32 will be (or at least available and not harmful to

A quick search and I couldn't find this issue already in your tracker.