cURL / Mailing Lists / curl-library / Single Mail

curl-library

Combining Curllib - openSSL issues

From: Mikael Nilsson <mikael_at_camf.com>
Date: Mon, 23 Feb 2009 09:27:57 +0100

Hello!

I am one of many that has big problems making Curllib to work with OpenSSL.
I have read all archived messages and answers about this issue, that I could
find,
but those sollutions did not apply to my issue. Ive read all different kind
of documentation
found in links and attachments, and different setups people have posted on
the net, but none of them
would solve my problem.

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.

What I want, is to have the Curllib+OpenSSL in a static lib, because I wont
be able to use the DLLs
after I am done with the project. I dont get any issues when using the DLLs,
which works fine.
But I cant use the DLLs after the development.

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.
When now I want to add OpenSSL to the project I use the following curllib
Settings:

WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_LIBCURL;CURL_STATICLIB;CURL_DISABLE_L
DAP
(I tried USE_SSLEAY;USE_OPENSSL aswell, didnt change anything)

I included "C:\OpenSSL\include" into C\C++->General->Additional Include
Directories

I added the following into the setup.h file:
#define USE_SSLEAY
#define USE_OPENSSL

The OpenSSL libs I am using, are precompiled static libs, which I got from
Shining Light Productions
(http://www.shininglightpro.com/products/Win32OpenSSL.html)
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.

I use these libs, because I cant compile my own OpenSSL libs. The CL.exe
returns errors that window.h is missing.
I tried to follow all "fixes" to this issue aswell, but none of them would
work.
I currently use the Multithreaded DLL as runtime library in release mode,
and Multithreaded DLL Debug, in debug mode.
I have tried other options aswell. With the same results.

But curllib and OpenSSL is compiling as debug or release. No problems at
all.
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

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

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

I then read somewhere, that OpenSSL might need zlib and ssh2, these I added
to the Curllib/OpenSSL sollution, which compiles fine
but same issue in my test sollution. I also tried just adding these libs
into the test sollution along with the compiled test lib,
with the same kind of result.

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

I once again, looked through after a answer to that specific error message,
but I could not find any answers, that works for me.
I get this error message, both in Release mode and in debug mode.

So, I am wondering, and hoping, if someone knows or thinks what the issue
could be with this problem?
I need to access HTTPS, thats why I need openSSL.
I use WinXP and Visual C++ 2005 Express, if that would give something to the
equation.

Thank you for your time,

Mikael
Received on 2009-02-23