最新の openssl で curl をビルドするにはどうすればいいですか?

最新の openssl で curl をビルドするにはどうすればいいですか?

そこでopensslを構築します

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

私はカールを作る

./configure --with-ssl 
make
make install

OpenSSL は正しくインストールされているようです:

openssl version
OpenSSL 1.0.1g 7 Apr 2014

ただし、curl は古い openssl バージョン (1.0.1g ではなく 1.0.1f) を使用します。

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 

curl で新しいバージョンを使用するにはどうすればいいですか?

奇妙なopenssl/curlのバグと格闘しているので、最新バージョンを試してみたいと思います#1 #2

編集:私も試しましたが./configure --with-ssl=/usr/local/ssl/include/openssl、成功しませんでした

編集2: これまでに試したこと:

  • 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

失敗...

答え1

OpenSSL がインストールされているディレクトリを指定する必要があります (シンボリックリンクは必要でも十分でもありません)

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

編集: あるいは、PKG_CONFIG_PATH環境変数を設定することもできます ( の提案に従って./configure --help):

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

答え2

sudo apt-get install libssl-dev
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
sudo make
sudo make install

Ubuntu 15.04でcurl 7.43をビルドするために必要なのはこれだけです

答え3

同じ練習をしていたときにわかったことは、curl は openssl の静的ライブラリでは動作しないということです。何をしていても常に動的ライブラリを探していたので、最終的に 3 つの方法を試してうまくいきました。

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

後者の -V フラグ付きコマンドは、curl が使用する openssl のバージョンを表示します。curl が正しい libcurl バージョンを使用するように、LD_LIBRARY_PATH に /usr/local/lib を追加しました。

答え4

./configure --with-ssl=/usr/lib/ssl --libdir=/usr/lib/x86_64-linux-gnu
sudo make
sudo make install

数時間苦労した後、Ubuntu 15.05でlibcurl 7.38を使用してhttpsを有効にすることができました。

関連情報