Mac OS X安裝libevent庫報Install libevent bufferevent_openssl.c:60:10: fatal error: 'openssl/bio.h' file

來源:互聯網
上載者:User

編譯 libevent(源檔案在/Users/carl/Downloads/libevent-2.1.8-stable),執行make命令是,報

Install libevent bufferevent_openssl.c:60:10: fatal error: 'openssl/bio.h' file

第一反應,感覺是不是 openssl版本太低了。


1. 查看openssl版本,發現版本比較低

$ openssl versionOpenSSL 0.9.8zh 14 Jan 2016

2. 升級spenssl,執行

brew install openssl

輸出(前面的輸出忽略)如下:

==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2l.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2l.sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
�  /usr/local/Cellar/openssl/1.0.2l: 1,709 files, 12.2MB

輸出以上資訊,說明安裝成功,安裝目錄在(/usr/local/Cellar/openssl/1.0.2l)

3. 配置openssl環境變數,指向新安裝的openssl

a. 執行 whereis openssl

輸出 /usr/bin/openssl

b. 備份原openssl,執行 mv /usr/bin/openssl /usr/bin/openssl_old

c. 建立openssl命令軟串連,執行 ln -s /usr/local/Cellar/openssl/1.0.2l/bin/openssl /usr/bin/openssl

d.再執行 openssl version

輸出 OpenSSL 1.0.2l  25 May 2017

說明升級成功。


openssl升級成功後,重新編譯libevent,執行make名了,還是報Install libevent bufferevent_openssl.c:60:10: fatal error: 'openssl/bio.h' file錯誤,

於是把新安裝的openssl目錄的下的標頭檔 拷貝到libevent源檔案目錄下,

執行 cp -R /usr/local/Cellar/openssl/1.0.2l/bin/openssl/include    /Users/carl/Downloads/libevent-2.1.8-stable

重新make,編譯成功。


參考資料 :

http://blog.csdn.net/hackcoder/article/details/52442350

http://blog.csdn.net/pz0605/article/details/51954868






相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.