cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Combining Curllib - openSSL issues

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 23 Feb 2009 10:15:33 +0100 (CET)

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?

> 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...

> 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.

> 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?

> 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?

> 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