cURL / Mailing Lists / curl-library / Single Mail


Re: Error in linking cUrl with OpenSSL

From: Dan Fandrich <>
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:, needed by ../lib/.libs/, not
> found (try using -rpath or -rpath-link)
> ../lib/.libs/ undefined reference to `SSL_connect'
> ../lib/.libs/ undefined reference to `X509_check_issued'
> ../lib/.libs/ undefined reference to `BIO_free'
> ../lib/.libs/ 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:
Received on 2011-10-04