如何使用最新的 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.1f而不是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 

如何讓curl使用新版本?

我想嘗試最新版本,因為我正在與一些奇怪的 openssl/curl bug 作鬥爭#1 #2

編輯:我也嘗試過./configure --with-ssl=/usr/local/ssl/include/openssl,沒有成功

Edit2:到目前為止我也嘗試過:

  • 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靜態庫一起使用。無論我在做什麼,它總是在尋找動力,所以最終我做了三件事對我有用

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 版本。我已將 /usr/local/lib 新增至 LD_LIBRARY_PATH 以確保curl 使用正確的 libcurl 版本。

答案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

相關內容