2017-04-14 71 views
3

我正在使用boost asio的C++項目。試圖建立使用亞庫,我收到以下錯誤在MacOS上找不到'openssl/conf.h'文件錯誤Sierra

/usr/local/include/boost/asio/ssl/detail/openssl_types.hpp:19:10: fatal error: 'openssl/conf.h' file not found 
#include <openssl/conf.h> 

尋找解決方案here & here的,我試過

brew install openssl 
brew link openssl --force 
xcode-select --install 

但並沒有幫助。

執行以下操作,也似乎不工作,我使用

export C_INCLUDE_PATH=/usr/local/include 
export CPLUS_INCLUDE_PATH=/usr/local/include 

升壓版本是boost_1_63_0。我在MacOS SierraXcode 8.3.1。我已經安裝使用Homebrew

brew install boost 

當我從其他的鏈接瞭解提振,Xcode是看錯了地方SSL頭。 但是我該如何解決這個問題?

我看着我的/usr/local/include & /opt/local/include。 'openssl/ssl.h'不存在於任何位置。但在做一個brew install openssl說以下

Warning: openssl is a keg-only and another version is linked to opt. 
Use `brew install --force` if you want to install this version 

做一個brew install openssl --force

Warning: openssl-1.0.2k already installed, it's just not linked. 

brew link openssl --force也不能解決問題。

多伊格一個which openssl返回如下:

/usr/local/bin/openssl 

請建議

回答

4

鏈接與否,所有已安裝的軟件包家釀通過鏈路可達中/usr/local/opt。另外,當你通過Homebrew安裝openssl時,Homebrew會告訴你如何使用openssl庫和頭文件。

~ [email protected] 15s 
❯ brew install openssl 
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2k.el_capitan.bottle.tar.gz 
Already downloaded: /Users/nega/Library/Caches/Homebrew/openssl-1.0.2k.el_capitan.bottle.tar.gz 
==> Pouring openssl-1.0.2k.el_capitan.bottle.tar.gz 
==> Using the sandbox 
==> 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. 

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 
For pkg-config to find this software you may need to set: 
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig 

==> Summary 
    /usr/local/Cellar/openssl/1.0.2k: 1,696 files, 12MB 

~ neg[email protected] 11s 
❯ 

你不需要brew link任何東西。只需使用Homebrew在Xcode和CMake的適當位置告訴你的目錄即可。

+0

好。我必須在我的cmake版本中包含並鏈接到openssl的安裝位置。謝謝你的澄清@nega –

+0

@nega - 對我來說不起作用,它說:openssl是一個小桶,而另一個版本是鏈接到選擇。 – dcp

+0

@dcp你是什麼意思它「不起作用」?也許如果你在這裏打開一個新的問題並鏈接到它,我可以幫忙。 – nega

相關問題