xcode 在 MacOS Sierra 上找不到“openssl/conf.h”文件错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43415106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'openssl/conf.h' file not found error on MacOS Sierra
提问by programmer_of_the_galaxies
I am working on a C++ project which uses boost asio. Trying to build the libraries that use Asia, I am getting the following error
我正在开发一个使用 boost asio 的 C++ 项目。尝试构建使用 Asia 的库时,出现以下错误
/usr/local/include/boost/asio/ssl/detail/openssl_types.hpp:19:10: fatal error: 'openssl/conf.h' file not found
#include <openssl/conf.h>
Looking of solutions here& here, I tried
brew install openssl
brew link openssl --force
xcode-select --install
But didn't help.
但没有帮助。
Doing the following also doesn't seem to work
执行以下操作似乎也不起作用
export C_INCLUDE_PATH=/usr/local/include
export CPLUS_INCLUDE_PATH=/usr/local/include
Boost version I am using is boost_1_63_0
. I am on MacOS Sierra
with Xcode 8.3.1
. I have installed boost using Homebrew
我正在使用的 Boost 版本是boost_1_63_0
. 我在MacOS Sierra
用Xcode 8.3.1
。我已经使用Homebrew安装了 boost
brew install boost
As I understand from other links, Xcode is looking at the wrong place for ssl headers. But how can I resolve this?
正如我从其他链接中了解到的,Xcode 正在寻找 ssl 标头的错误位置。但是我该如何解决这个问题?
I looked into my /usr/local/include
& /opt/local/include
. 'openssl/ssl.h' is not present in either locations. But doing a brew install openssl
says the following
我查看了我的/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
Doing a brew install openssl --force
says
做一个brew install openssl --force
说
Warning: openssl-1.0.2k already installed, it's just not linked.
Doing brew link openssl --force
also doesn't solve the issue.
这样做brew link openssl --force
也不能解决问题。
Doig a which openssl
returns the following:
Doig awhich openssl
返回以下内容:
/usr/local/bin/openssl
Please suggest
请建议
回答by nega
Linked or not, all installed Homebrew packages are reachable via link in /usr/local/opt
. Additionally, when you install openssl
via Homebrew, Homebrew tells you how to use the openssl libraries and headers.
无论是否链接,所有已安装的 Homebrew 软件包都可以通过/usr/local/opt
. 此外,当您openssl
通过 Homebrew安装时,Homebrew 会告诉您如何使用 openssl 库和标头。
~ nega@rust 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
~ nega@rust 11s
?
You don't need to brew link
anything. Just use the directories Homebrew tells you about in the appropriate places in Xcode and CMake.
你什么都不需要brew link
。只需在 Xcode 和 CMake 的适当位置使用 Homebrew 告诉您的目录。