cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: recompiling curl to NOT use system openssl

From: Brian Dessent <brian_at_dessent.net>
Date: Fri, 05 Sep 2008 13:56:09 -0700

Peter Wilkes wrote:

> the error was a link error trying to mutliple functions starting with
> "dl" like dlopen.
>
> i'd really like to use a static build if possible. is there a
> workaround for this?

When linking static libraries, dependencies are not transitive; they
must be explicitly spelled out. For example suppose A links against
libB. libB itself depends on libC, but A doesn't directly use any libC
interfaces. In this case when linking A against shared libB, "-lB" is
all that is required. But when linking A against static libB, "-lB -lC"
is required, because B's dependency on C is now part of A since B's code
is essentially being copied into A.

This is the case that you're seeing, where A is curl, B is openssl, and
C is libdl. Long story short, you have to add -ldl (and possibly
others) to LIBS when configuring curl, i.e. ./configure --whatever
LIBS="-ldl".

IIRC pkg-config has a facility to differentiate between the two with
e.g. --libs and --static-libs or however they spell it. You should
check openssl's .pc file to see if this is setup properly, in which case
it should be possible to set LIBS via "pkg-config openssl --static-libs"
or however it's spelled.

Brian
Received on 2008-09-05