cURL / Mailing Lists / curl-users / Single Mail

curl-users

Problems building curl (7.16.2 - 7.17.1) with Openssl 0.9.8

From: Calen Pennington <cpennington_at_Endeca.com>
Date: Tue, 18 Dec 2007 17:34:24 -0500

I have been trying to build curl from source on 32 and 64 bit Red Hat
Enterprise Linux. I am having slightly different problems on each. In
particular, on the 32 bit machine, openssl is recognized, but then -lssl
and -lcrypto aren't being added to the link line correctly, leading to
link errors. On the 64 bit machine, openssl isn't being recognized at
all, which means that curl builds, but with no ssl support.

Now, on to the details:
The commands I am running are:
(cd curl-<version>; CC="gcc" CXX="g++" ./configure
--prefix=/path/to/output/curl --with-ssl=/path/to/openssl
--without-libidn; make; make install)

On 32-bit, the configure runs fine, and includes the lines:
checking for CRYPTO_lock in -lcrypto... yes
checking for SSL_connect in -lssl... yes
checking openssl/x509.h usability... yes
checking openssl/x509.h presence... yes
checking for openssl/x509.h... yes
checking openssl/rsa.h usability... yes
checking openssl/rsa.h presence... yes
checking for openssl/rsa.h... yes
checking openssl/crypto.h usability... yes
checking openssl/crypto.h presence... yes
checking for openssl/crypto.h... yes
checking openssl/pem.h usability... yes
checking openssl/pem.h presence... yes
checking for openssl/pem.h... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/pkcs12.h usability... yes
checking openssl/pkcs12.h presence... yes
checking for openssl/pkcs12.h... yes
checking for ENGINE_init... yes
checking openssl/engine.h usability... yes
checking openssl/engine.h presence... yes
checking for openssl/engine.h... yes
checking for ENGINE_load_builtin_engines... yes
checking for RAND_status... yes
checking for RAND_screen... no
checking for RAND_egd... yes
checking for CRYPTO_cleanup_all_ex_data... yes
checking for SSL_get_shutdown... yes
checking for yaSSL using OpenSSL compatibility mode... no
configure: Added
/nfs/eng/cpenning/DEV/trunk/prebuilts-source/linux-x86/install/openssl/l
ib to LD_LIBRARY_PATH

However, when make runs, the build reaches the following point and
fails:

/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2
-L/nfs/eng/cpenning/DEV/trunk/prebuilts-source/linux-x86/install/openssl
/lib -o curl main.o hugehelp.o urlglob.o writeout.o writeenv.o getpass.o
homedir.o curlutil.o strtoofft.o strdup.o ../lib/libcurl.la -lz
mkdir .libs
gcc -g -O2 -o .libs/curl main.o hugehelp.o urlglob.o writeout.o
writeenv.o getpass.o homedir.o curlutil.o strtoofft.o strdup.o
-L/nfs/eng/cpenning/DEV/trunk/prebuilts-source/linux-x86/install/openssl
/lib ../lib/.libs/libcurl.so -lz -Wl,--rpath
-Wl,/nfs/eng/cpenning/DEV/trunk/prebuilts-source/linux-x86/build/src/thi
rd-party/curl/lib
/usr/dev_tools/170681/bin/ld: warning: libssl.so.0.9.8, needed by
../lib/.libs/libcurl.so, not found (try using -rpath or -rpath-link)
/usr/dev_tools/170681/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 `RAND_load_file'
../lib/.libs/libcurl.so: undefined reference to
`SSL_CTX_use_certificate'
../lib/.libs/libcurl.so: undefined reference to
`ENGINE_load_private_key'
../lib/.libs/libcurl.so: undefined reference to `SSL_set_fd'
../lib/.libs/libcurl.so: undefined reference to `SSL_set_connect_state'
../lib/.libs/libcurl.so: undefined reference to `SSL_CTX_free'
../lib/.libs/libcurl.so: undefined reference to `ENGINE_get_first'
../lib/.libs/libcurl.so: undefined reference to `X509_free'
<snip numerous additional undefined references>

If I manually run the following command (note the added "-lcrypto
-lssl"), then there are no errors:
gcc -g -O2 -o .libs/curl main.o hugehelp.o urlglob.o writeout.o
writeenv.o getpass.o homedir.o curlutil.o strtoofft.o strdup.o
-L/nfs/eng/cpenning/DEV/trunk/prebuilts-source/linux-x86/install/openssl
/lib ../lib/.libs/libcurl.so -lcrypto -lssl -lz -Wl,--rpath
-Wl,/nfs/eng/cpenning/DEV/trunk/prebuilts-source/linux-x86/build/src/thi
rd-party/curl/lib

From inspection of src/Makefile, it appears that -lcrypto and -lssl
appear in the LIBCURL_LIBS variable, but that that variable isn't being
used to set LIBS before the implicit rule is executed:
curl$(EXEEXT): $(curl_OBJECTS) $(curl_DEPENDENCIES)
        @rm -f curl$(EXEEXT)
        $(LINK) $(curl_OBJECTS) $(curl_LDADD) $(LIBS)

Finally, this same problem does not occur in 7.16.1. In that version,
and previous versions that I have tried, curl builds correctly. Is there
some additional command I can give to ./configure to force "-lcrypto
-lssl" to be added to the link line? (I have tried setting the LIBS
environment variable, but that causes other difficulties)

On 64-bit, the command I run is the same. However, during configure, the
following lines appear:
checking for CRYPTO_lock in -lcrypto... no
checking for CRYPTO_add_lock in -lcrypto... no
checking for inflateEnd in -lz... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
configure: found both libz and libz.h header
checking for libssh2_channel_open_ex in -lssh2... no
checking libssh2.h usability... no
checking libssh2.h presence... no
checking for libssh2.h... no
configure: WARNING: SSL disabled, you will not be able to use HTTPS,
FTPS, NTLM and more.
configure: WARNING: Use --with-ssl, --with-gnutls or --with-nss to
address this.

However, as noted above, I am using with-ssl.

If possible, I would like to keep the variation between the platforms
minimal. Any suggestions?

Thanks
-Cale

- - - - - - - - - - - - - - - - - - - - - - - - - - -

Calen Pennington
Software Engineer
T +1 617.674.6364
E cpennington_at_endeca.com

Endeca
101 Main Street
Cambridge, MA 02142
http://www.endeca.com/

find / analyze / understand
Received on 2007-12-18