Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I build openssl

sudo make install
sudo ln -sf /usr/local/ssl/bin/openssl `which openssl`

I build curl

./configure --with-ssl 
make install

OpenSSL looks installed correctly:

openssl version
OpenSSL 1.0.1g 7 Apr 2014

however curl uses old openssl version (1.0.1f instead of 1.0.1g):

curl --version
curl 7.37.0 (x86_64-unknown-linux-gnu) libcurl/7.37.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 

how to make curl use new version?

I want to try the newest versions, because I am fighting with some strange openssl/curl bug #1 #2

Edit: I also tried ./configure --with-ssl=/usr/local/ssl/include/openssl, no success

Edit2: So far I also tried:

  • sudo ./configure --with-ssl --with-libssl-prefix=/usr/local/ssl
  • ./configure --with-ssl=/usr/local/ssl
  • PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig ./configure
  • PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig ./configure --with-ssl
  • PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig ./configure --with-ssl=/usr/local/ssl/include/openssl

no success...

share|improve this question

You need to specify the directory where OpenSSL is installed (your symlink is neither necessary nor sufficient)

./configure --with-ssl=/usr/local/ssl

EDIT: Alternatively, you can set your PKG_CONFIG_PATH environment variable (as suggested by ./configure --help):

PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig ./configure

share|improve this answer
first option gives me configure: error: OpenSSL libs and/or directories were not found where specified! Please see my edit - there is no error with --with-ssl=/usr/local/ssl/include/openssl but old openssl is used. second option configures curl without HTTPS – Peter Jun 2 '14 at 10:50
I may have gotten the directories slightly wrong, I don't have access to a Linux box right now... Basically, your manual OpenSSL installation put a file openssl.pcsomewhere, you need to point PKG_CONFIG_PATH to the directory where that file is (and make sure you have pkg-config installed, of course). – fkraiem Jun 2 '14 at 11:06
PKG_CONFIG_PATH path is correct, I have pkg-config installed too, but somehow it doesn't work. without --with-ssl there is no HTTPS, with --with-sslit throws error configure: error: OpenSSL libs and/or directories were not found where specified! – Peter Jun 2 '14 at 11:07
Where and how did you install ssl ? Use the correct path. – bodhi.zazen Jun 2 '14 at 15:01
@bodhi.zazen I have install both Ubuntu package from official repositories and compiled openssl in /usr/local/ssl – Peter Jun 5 '14 at 8:25

What I found out, when I was going through the same exercise, is that curl simply can't work with openssl static libraries. It was always searching for dynamic, no matter what I was doing, so eventually I did three things that worked for me

Configured openssl with enable-shared: ./config enable-shared
Configured curl with openssl: ./configure --with-ssl
Used LD_LIBRARY_PATH: LD_LIBRARY_PATH=/usr/local/lib:/usr/local/ssl/lib /usr/local/bin/curl -V

The latter command with -V flag will show the openssl version used by curl. I've added /usr/local/lib to LD_LIBRARY_PATH to make sure that curl uses the right libcurl version.

share|improve this answer
This helped me, particularly LD_LIBRARY_PATH which I've added to bash_profile. I did something similar, but instead of the first line, I used export CFLAGS=-fPIC; ./config shared (not enable-shared). For curl, I used --with-ssl=/usr/local/ssl although the path arg may have been redundant. – mahemoff Sep 3 '15 at 10:32
I'm glad it worked for you and yes, path in --with-ssl is redundant, because what you've provided is a default location for the build. – Oleg Gryb Sep 3 '15 at 16:17
sudo apt-get install libssl-dev
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
sudo make
sudo make install

Is all I needed to build curl 7.43 on ubuntu 15.04

share|improve this answer
./configure --with-ssl=/usr/lib/ssl --libdir=/usr/lib/x86_64-linux-gnu
sudo make
sudo make install

After struggling some hours I managed to enable https with libcurl 7.38 in ubuntu 15.05

share|improve this answer

I managed to compile curl using static OpenSSL libraries. This is the tl;dr version:


./config no-shared --prefix=$PWD/_installdir
make depend && make && make install


LIBS="-ldl" ./configure --prefix=$PWD/_installdir --with-ssl=/something/opensslrootdir/_installdir --disable-shared
make && make install

The LIBS="-ldl" part is essential.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.