cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Quanah Gibson-Mount <quanah_at_zimbra.com>
Date: Mon, 04 Mar 2013 13:56:45 -0800

--On Monday, March 04, 2013 9:58 PM +0100 Jeroen DR
<voetsjoeba+curl_at_gmail.com> wrote:

>
>
> You're right, libcurl.la does contain such a line:
>
> $ cat lib/libcurl.la
> ...
> dependency_libs=' -lssl -lcrypto -lz -lrt - L/home/ct-dist/myopenssl/lib'
> ...
>
> Still though, these flags are apparently not being included on the
> final command line that libtool (?) executes.
>
> And yet, the -L/home/ct-dist/myopenssl/lib bit *is* there, which could
> only have come from `pkg-config --libs openssl`, which I know to also
> include the -lssl -lcrypto bits. Is it slicing and dicing? What's
> going on?

I routinely build curl against my own OpenSSL and Heimdal builds without
issue:

build_at_zre-ubuntu12-64:/opt/zimbra/curl-7.29.0/bin$ ldd curl
        linux-vdso.so.1 => (0x00007fffb418a000)
        libcurl.so.4 => /opt/zimbra/curl-7.29.0/lib/libcurl.so.4
(0x00007f76c585e000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f76c5640000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f76c5438000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f76c521b000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f76c4e5c000)
        libssl.so.1.0.0 => /opt/zimbra/openssl-1.0.1e/lib/libssl.so.1.0.0
(0x00007f76c4bf1000)
        libcrypto.so.1.0.0 =>
/opt/zimbra/openssl-1.0.1e/lib/libcrypto.so.1.0.0 (0x00007f76c4819000)
        libgssapi.so.3 => /opt/zimbra/heimdal-1.5.2/lib/libgssapi.so.3
(0x00007f76c45db000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f76c5abb000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f76c43d6000)
        libheimntlm.so.0 => /opt/zimbra/heimdal-1.5.2/lib/libheimntlm.so.0
(0x00007f76c41cf000)
        libkrb5.so.26 => /opt/zimbra/heimdal-1.5.2/lib/libkrb5.so.26
(0x00007f76c3f4d000)
        libheimbase.so.1 => /opt/zimbra/heimdal-1.5.2/lib/libheimbase.so.1
(0x00007f76c3d48000)
        libhx509.so.5 => /opt/zimbra/heimdal-1.5.2/lib/libhx509.so.5
(0x00007f76c3afd000)
        libwind.so.0 => /opt/zimbra/heimdal-1.5.2/lib/libwind.so.0
(0x00007f76c38d4000)
        libheimsqlite.so.0 =>
/opt/zimbra/heimdal-1.5.2/lib/libheimsqlite.so.0 (0x00007f76c364b000)
        libasn1.so.8 => /opt/zimbra/heimdal-1.5.2/lib/libasn1.so.8
(0x00007f76c33ad000)
        libcom_err.so.1 => /opt/zimbra/heimdal-1.5.2/lib/libcom_err.so.1
(0x00007f76c31a9000)
        libroken.so.18 => /opt/zimbra/heimdal-1.5.2/lib/libroken.so.18
(0x00007f76c2f93000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1
(0x00007f76c2d5a000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2
(0x00007f76c2b3e000)

Generally it is a matter of setting the various flags correctly. This is
what I do:

        LDFLAGS := LDFLAGS="-L$(OPENSSL_LIB_DIR) -L$(HEIMDAL_LIB_DIR)
-L$(CURL_LIB_DIR) -Wl,-rpath,$(OPENSSL_LIB_DIR)
-Wl,-rpath,$(HEIMDAL_LIB_DIR) -Wl,-rpath,$(CURL_LIB_DIR)"

build:
        tar xzf src/curl-$(CURL_VERSION).tar.gz
        (cd curl-$(CURL_VERSION); \
        $(SED) -i -e 's|https://mxr.mozilla.org|http://mxr.mozilla.org|'
lib/mk-ca-bundle.pl; \
        $(PATCH) \
        ./buildconf; \
 
DYLD_LIBRARY_PATH=$(OPENSSL_LIB_DIR):$(HEIMDAL_LIB_DIR):$(CURL_LIB_DIR) \
        LD_RUN_PATH=$(OPENSSL_LIB_DIR):$(HEIMDAL_LIB_DIR):$(CURL_LIB_DIR) \
        $(LDFLAGS) \
        CFLAGS="-g -O2" \
        ./configure --prefix=$(ZIMBRA_HOME)/curl-$(CURL_VERSION)
--disable-ldap --disable-ldaps \
                --with-gssapi=/opt/zimbra/heimdal-$(HEIMDAL_VERSION) \
                --with-ssl=/opt/zimbra/openssl-$(OPENSSL_VERSION) \
                --without-gnutls \
 
--with-ca-bundle=/opt/zimbra/curl-$(CURL_VERSION)/share/curl/ca-bundle.crt \
                --with-zlib=$(LIB_DIR) \
                --with-libidn=$(LIB_DIR))
        (cd curl-$(CURL_VERSION);
LD_RUN_PATH=$(OPENSSL_LIB_DIR):$(HEIMDAL_LIB_DIR):$(CURL_LIB_DIR) $(MAKE)
$(MAKEARGS))
        (cd curl-$(CURL_VERSION);
LD_RUN_PATH=$(OPENSSL_LIB_DIR):$(HEIMDAL_LIB_DIR):$(CURL_LIB_DIR) $(MAKE)
$(MAKEARGS) install)
        (cd curl-$(CURL_VERSION); $(MAKE) ca-bundle)
        mkdir -p $(ZIMBRA_HOME)/curl-$(CURL_VERSION)/share/curl
        (cd curl-$(CURL_VERSION); cp -f lib/ca-bundle.crt
$(ZIMBRA_HOME)/curl-$(CURL_VERSION)/share/curl/ca-bundle.crt)
        (cd $(ZIMBRA_HOME); ln -s curl-$(CURL_VERSION) curl)

--
Quanah Gibson-Mount
Sr. Member of Technical Staff
Zimbra, Inc
A Division of VMware, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-04