cURL / Mailing Lists / curl-library / Single Mail


curl-7.29.0: 'curl' executable fails to link against custom-built OpenSSL

From: Jeroen De Ridder <>
Date: Mon, 4 Mar 2013 16:34:48 +0100

I'm currently building curl-7.29.0 from source on a RHEL 5 64-bit
machine against a custom-compiled version of OpenSSL 1.0.0j that's
installed in /home/ct-dist/myopenssl. There is also an old system
library of OpenSSL on my machine, with sonames and (as opposed to and
of the new installation). For now, I'm only doing a shared library
build, and I want to build it against the OpenSSL 1.0.0j installation.
The build goes OK and successfully creates with the correct
dependencies on the new OpenSSL libraries, but the final stage where
it has to link the 'curl' executable fails with the following error
(snipped a bit for brevity):

/bin/sh ../libtool --tag=CC --mode=link gcc -g -O0
-Wno-system-headers -L/home/ct-dist/myopenssl/lib -o curl
curl-tool_binmode.o [..snip..] curl-nonblock.o ../lib/ -lz

libtool: link: gcc -g -O0 -Wno-system-headers -o .libs/curl
curl-tool_binmode.o [..snip..] curl-nonblock.o
-L/home/ct-dist/myopenssl/lib ../lib/.libs/ -lz -lrt
-Wl,-rpath -Wl,/home/ct-dist/mycurl/lib
/usr/bin/ld: warning:, needed by
../lib/.libs/, not found (try using -rpath or -rpath-link)
/usr/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'

Notice that the command line does not specify -lssl and -lcrypto,
although it looks like they should be in there. Indeed, when I add
these back in, the link completes nicely without any further
Looking at src/Makefile, it appears that the rule that performs this
link is the following:

    @rm -f curl$(EXEEXT)
    $(curl_LINK) $(curl_OBJECTS) $(curl_LDADD) $(LIBS)

Printing out these variables shows the following:
    curl_LDADD = ../lib/ -lz -lrt
    curl_LIBS =

And the definition of curl_LDADD higher up shows the following:

curl_LDADD = $(top_builddir)/lib/ -lz -lrt
#curl_LDADD = $(top_builddir)/lib/ -lidn -lssl -lcrypto
-lssl -lcrypto -lz -lrt

So evidently at one point the -lssl -lcrypto flags were there, but
they were commented out and removed. What happened? How come they
aren't in there anymore?

For reference:
Per ./configure --help's suggestion, I'm using pkg-config to tell curl
about the location of my custom-built OpenSSL libraries by editing the
PKG_CONFIG_PATH environment variable. This seems to work well, given
the fact that everything but the final curl executable compiles and
links fine. Here's my build script:

export PKG_CONFIG_PATH="/home/ct-dist/myopenssl/lib/pkgconfig:$PKG_CONFIG_PATH"
CONFIGURE="./configure --prefix=/home/ct-dist/mycurl \
                       --disable-maintainer-mode \
                       --enable-debug \
                       --disable-static \
                       --disable-optimize \
                       --disable-warnings \
                       --disable-werror \
                       --disable-ldap \
                       --disable-ldaps \
                       --without-polarssl \
                       --without-cyassl \
                       --without-gnutls \
                       --without-nss \
                       --without-axtls \
                       --without-libssh2 \

make clean
$CONFIGURE && make && make install

-- Jeroen
List admin:
Received on 2013-03-04