'openssl/conf.h' 在 MacOS Sierra 上找不到文件错误
'openssl/conf.h' file not found error on MacOS Sierra
我正在开发一个使用 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>
寻找解决方案 & 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 Sierra
和 Xcode 8.3.1
。我已经使用 Homebrew
安装了 boost
brew install boost
我从其他链接了解到,Xcode 正在寻找 ssl headers 的错误位置。
但是我该如何解决这个问题?
我查看了我的 /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
returns:
/usr/local/bin/openssl
求推荐
无论是否链接,所有已安装的 Homebrew 软件包都可以通过 /usr/local/opt
中的 link 访问。此外,当您通过 Homebrew 安装 openssl
时,Homebrew 会告诉您如何使用 openssl 库和 headers.
~ 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
❯
您不需要brew link
任何东西。只需在 Xcode 和 CMake.
的适当位置使用 Homebrew 告诉您的目录即可
感谢@nega for 。不幸的是,我发布了 Apple M1 芯片 (Arm64) 安装消息的更新版本,该消息太长而无法留下评论!
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/opt/homebrew/etc/openssl@1.1/certs
and run
/opt/homebrew/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
正如@nega 所说,您不需要酿造 link 任何东西。我按照消息中的建议在 bash 会话中导出了环境变量 PATH、LDFLAGS 和 CPPFLAGS,然后 make
对我来说工作正常。
我正在开发一个使用 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>
寻找解决方案
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 Sierra
和 Xcode 8.3.1
。我已经使用 Homebrew
brew install boost
我从其他链接了解到,Xcode 正在寻找 ssl headers 的错误位置。 但是我该如何解决这个问题?
我查看了我的 /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
returns:
/usr/local/bin/openssl
求推荐
无论是否链接,所有已安装的 Homebrew 软件包都可以通过 /usr/local/opt
中的 link 访问。此外,当您通过 Homebrew 安装 openssl
时,Homebrew 会告诉您如何使用 openssl 库和 headers.
~ 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
❯
您不需要brew link
任何东西。只需在 Xcode 和 CMake.
感谢@nega for
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/opt/homebrew/etc/openssl@1.1/certs
and run
/opt/homebrew/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
正如@nega 所说,您不需要酿造 link 任何东西。我按照消息中的建议在 bash 会话中导出了环境变量 PATH、LDFLAGS 和 CPPFLAGS,然后 make
对我来说工作正常。