Sossisos
Sossisos

Reputation: 1589

Building openssl and libcurl for linux from source

I am trying to build openssl and libcurl from source. At first glance this looks like it should be very easy, but I can't get my curl build to recognize my openssl libs.

I have tried the following steps:

pwd
$ /home/sossisos/curlssl/
wget https://www.openssl.org/source/openssl-1.0.2i.tar.gz
tar xzf openssl-1.0.2i.tar.gz
cd openssl-1.0.2i
./config
make
cp libcrypto.a libssl.a ../ssl/lib/
cp -R include/ ../ssl/

cd ..
wget https://curl.haxx.se/download/curl-7.50.3.tar.gz
tar xzf curl-7.50.3.tar.gz
cd curl-7.50.3
./configure --with-ssl="/home/sossisos/curlssl/ssl/"

But the config results for curl says

curl version:     7.50.3
Host setup:       x86_64-pc-linux-gnu
Install prefix:   /usr/local
Compiler:         gcc
SSL support:      no      (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )

Further up it also says

checking whether to enable Windows native SSL/TLS (Windows native builds only)... no
checking whether to enable iOS/Mac OS X native SSL/TLS... no
configure: PKG_CONFIG_LIBDIR will be set to "/home/sossisos/curlssl/ssl/lib/pkgconfig"
checking for HMAC_Update in -lcrypto... no
checking for HMAC_Init_ex in -lcrypto... no
checking for ssl_version in -laxtls... no
configure: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.
configure: WARNING: Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.

I also tried the following curl config call

LDFLAGS="-L/home/sossisos/curlssl/ssl/lib/" ./configure --with-ssl="/home/sossisos/curlssl/ssl/"

Am I doing something wrong with my openssl build? Or my curl build? Is it not possible to link openssl statically to curl?

Upvotes: 1

Views: 1931

Answers (1)

Sossisos
Sossisos

Reputation: 1589

The answer turned out to be really simple. All that was needed was adding the "ldl" lib and "--disable-shared" flag to the curl configure call, as such

LIBS="-ldl" ./configure --with-ssl="/home/sossisos/curlssl/ssl/" --disable-shared

And then

make

That's it!

Upvotes: 2

Related Questions