cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Combining Curllib - openSSL issues

From: Mikael Nilsson <mikael_at_camf.com>
Date: Mon, 23 Feb 2009 14:26:54 +0100

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Montag, 23. Februar 2009 10:16
To: libcurl development
Subject: Re: Combining Curllib - openSSL issues

On Mon, 23 Feb 2009, Mikael Nilsson wrote:

> I am one of many that has big problems making Curllib to work with
OpenSSL.

>There are many?

>And BTW, the library is called libcurl and nothing else. Your post here
made
>me decide I will hunt down and erase all the "curllib" references we still
>have left.

> My problem is that I cant use Curllib with OpenSSL. They compile together,

> and they work seperatly, but when combining them into one lib, I get
either
> a number of linker errors, or just one strange error which I cant find a
> reason why I am getting it, or how to solve it.

>This is really neither an OpenSSL nor libcurl issue, but an issue with your

>build (setup).

> I have downloaded the latest Curllib (currently: curl-7.19.3) and the
latest
> OpenSSL (currently: v0.9.8j). I use the source code from Curllib and it
> compiles just fine on itself, without OpenSSL.

>Surely you build libcurl with SSL enabled though?

Yes, I did. If I don't build libcurl with SSL enabled, I don't get any
linker errors or
Other errors.

> The OpenSSL libs I am using, are precompiled static libs, which I got from

> Shining Light Productions
> (http://www.shininglightpro.com/products/Win32OpenSSL.html)

>From the little I know of Windows development, getting a precompiled lib
from
somewhere without very careful consderations is a recipe for disaster. You
need to keep very careful track of what MT, MD (or whatever they're called)
options that were used so that all of your app's libs use the same.

> These libs works as far as I can see, and they dont give any linker errors

> or anything when I link them to a test project and accesses a couple of
> functions within the lib.

>So you can link statically with weither one of the libs and they both work
>fine that way? Uh, that would of course require that you then have a
libcurl
>that is built without SSL support...

Yes, when I tried the libcurl alone, it was without SSL support.
It was just to check so the lib was working properly at all.

> I use these libs, because I cant compile my own OpenSSL libs. The CL.exe
> returns errors that window.h is missing.

>Uh-oh. I would rectify that first, if I were you.

I also tried the libcurl nmake function, that one aswell, failed as the
OpenSSL did.
So somewhere somehow there must be some issue, since both of them return the
same error.
I have tried to run them both from the normal cmd and the VC++ cmd window.
Changing the path to where I keep the windows SDK inside the makefile,
didn't solve it,
so I have to dig little deeper into that.

So I am gonna see if I can solve this issue first hand.

> The issue comes, when I use that compiled lib (curllib + OpenSSL) in a new
> project. I use the following settings:
>
> (C/C++->Preprocessor->Preprocessor Definitions)
>
WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_LIBCURL;CURL_STATICLIB;CURL_DISABLE_L
> DAP
> (I tried USE_SSLEAY;USE_OPENSSL aswell, didnt change anything)
>
> (Linker->Input->Additional Dependencies)
> libeay32MD.lib, ssleay32MD.lib, wldap32.lib, Ws2_32.lib, Winmm.lib,
> curllib.lib

>By "new project" you mean you're building libcurl again? Why don't you just

>use the makefile approach or the existing project files?

What I meant with new project, is this test project I have, just to check if
the libcurl+SSL lib is working
Properly. Basicly just a little project which I call on libcurl functions.

As I stated above, I tried the makefile approach, and since that one failed
aswell, I will firsthand see
If I can find a reason for it to fail. Both with SSL support and without.
I never use makefile, because its little confusing for me, and using the
vcproj is better/easier for me.

> When I tries to compile this, in either debug or release mode, I get 18
> linker error messages, below I have three of them:

>Compile what? libcurl?

This would be the test project with the libcurl+SSL lib.

> libeay32MD.lib(rand_win.obj) : error LNK2019: unresolved external symbol
> __imp__DeleteDC_at_4 referenced in function _readscreen
> libeay32MD.lib(cryptlib.obj) : error LNK2019: unresolved external symbol
> __imp__GetUserObjectInformationW_at_20 referenced in function
> _OPENSSL_isservice
> libeay32MD.lib(cryptlib.obj) : error LNK2019: unresolved external symbol
> __imp__MessageBoxA_at_16 referenced in function _OPENSSL_showfatal

That sounds like the libs you link with here is not providing the necessary
functions. It sounds like that OpenSSL lib you use require functions you
need
to provide somehow. Either with another lib, or with another windows
version.
I don't know.

> I then read somewhere, that OpenSSL might need zlib and ssh2

>OpenSSL can use libz yes. 'ssh2' no.

> Then I read in a document that OpenSSL as a static lib, needs some extra
> input dependencies, so I added: WSOCK32.LIB, ADVAPI32.LIB, GDI32.LIB and
> USER32.LIB
>
> If I use the above libs to the test sollution, I only get one error
message:
> libeay32MD.lib(cryptlib.obj) : fatal error LNK1103: debugging information
> corrupt; recompile module

>That sounds like your openssl lib is corrupt... Could it be due to the mix
of
>libs?

-- 
  / daniel.haxx.se
Received on 2009-02-23