cURL / Mailing Lists / curl-library / Single Mail

curl-library

Error in linking cUrl with OpenSSL

From: Gökhan Şengün <gokhansengun_at_gmail.com>
Date: Tue, 4 Oct 2011 14:25:06 +0300

Hello Everyone,

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.

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.

LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    $(AM_LDFLAGS) $(LDFLAGS) -o $@

I worked-around the error I encountered by adding the OpenSSL libraries to
the link command given above.

I am wondering if I am missing something here or there is something wrong in
the generation of makefiles.

The config command is given like below.

Thanks in advance for the help.

./configure ${CROSS_SWITCHES} \
  --host=powerpc-aud-linux \
  --libdir=${TOOLCHAIN_LIBDIR} \
  --includedir=${TOOLCHAIN_INCDIR} \
  --with-ssl=$HOST_OPENSSL_DIR \
  --enable-ipv6 \
  --enable-verbose \
  --enable-smtp \
  --enable-ftp \
  --enable-http \
  --enable-libgcc \
  --enable-shared \
  --enable-crypto-auth \
  --enable-nonblocking \
  --enable-debug \
  --disable-threaded-resolve \
  --disable-file \
  --disable-ldap \
  --disable-ldaps \
  --disable-rtsp \
  --disable-proxy \
  --disable-dict \
  --disable-telnet \
  --disable-tftp \
  --disable-pop3 \
  --disable-imap \
  --disable-gopher \
  --disable-manual \
  --disable-sspi

-- 
if you can't find a good name for a function, then perhaps it is not a good
function to write

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