cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Error in linking cUrl with OpenSSL

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 4 Oct 2011 09:11:57 -0700

On Tue, Oct 04, 2011 at 02:25:06PM +0300, Gökhan ?engün wrote:
> I have configured libcurl and curl with OpenSSL support for an embedded linux -
> powerpc platform. Since I am doing a cross-compile, OpenSSL directory was not
> the one curl expects by default, so I created a folder consisting of two
> directories named "lib" and "include" which obviously include the library and
> header files in the format that curl expect like described in the installation
> document.

The preferred method of linking against OpenSSL is by using pkg-config.
By setting PKG_CONFIG_PATH to the version you expect, that should result
in a working build.

> After successful compile and link of source files under "lib" folder, error
> occurs during link stage of files under "/src" folder.
>
> /bin/ld: warning: libcrypto.so.0.9.8, needed by ../lib/.libs/libcurl.so, not
> found (try using -rpath or -rpath-link)
> ../lib/.libs/libcurl.so: undefined reference to `SSL_connect'
> ../lib/.libs/libcurl.so: undefined reference to `X509_check_issued'
> ../lib/.libs/libcurl.so: undefined reference to `BIO_free'
> ../lib/.libs/libcurl.so: undefined reference to `BIO_s_mem'
>
> It was seen from the link command that the libraries (-lssl -lcrypto) needed
> for OpenSSL were missing. Checking the Makefile generated under "src"
> directory, -- as seen below -- the libraries are not added to the link command
> although there is already a variable (LIBCURL_LIBS = -lssl -lcrypto -lrt)
> defined.

On a dynamically-linked Linux system, the curl binary should not link
against the OpenSSL libraries directly since the curl front-end is agnostic to
the actual TLS library in use. If libcurl is compiled with GnuTLS instead,
the curl binary can still work unchanged. If you're linking against OpenSSL
statically, then the curl build system won't work properly and you'll
have to resort to setting flags manually.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-04