在MacOS上找不到'openssl/conf.h'文件错误Sierra

问题描述:

我正在使用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 

请建议

链接与否,所有已安装的软件包家酿通过链路可达中/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