无法在 macOS-Sierra 上使用 openssl
Can't use openssl on macOS-Sierra
我想在我的 Mac.
上安装 openssl 运行 CLion (CMake)
用自制软件安装了 openssl
brew install openssl
但是 CLion 仍然无法找到 openssl。过去可以使用
brew link openssl
不过今天好像homebrew拒绝了。
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
然后我在 CLion 中使用了以下 cmake 选项 (CMakeLists.txt)
set(I "/usr/local/opt/openssl/include")
set(L "/usr/local/opt/openssl/lib")
include_directories(${I})
但我仍然得到:
Undefined symbols for architecture x86_64:
"_EVP_DigestSignFinal", referenced from:
Undefined symbols for architecture x86_64:
"_EVP_DigestSignFinal", referenced from:
OpenSSL::signMsg(Buffer, Buffer, SignOptions) in libMyLib.a(ssl_state.cpp.o)
OpenSSL::signMsg(Buffer, Buffer, SignOptions) in libMyLib.a(ssl_state.cpp.o)
我能找到的关于这个主题的几乎所有内容都是关于旧版本的 macOS,但 Apple 已经从 openssl 0.9.8 中删除了 development-headers,因此许多指南不再有效。
这似乎是链接的问题。我正在使用 Macports 而不是 Homebrew,但也在 MacOS Sierra 上使用。
因为我看不到你的代码并且你没有提供最低工作示例,所以我使用了:https://github.com/Andersbakken/openssl-examples.git
和你一样,我在CMakeLists.txt
中添加了以下几行
set(I "/opt/local/include")
set(L "/opt/local/lib")
include_directories(${I})
对我来说效果很好:
cmake .
make
您是否验证过,必要的文件实际上在路径下可用,您输入 CMakeLists.txt
?
你试过了吗:
brew info openssl
我想在我的 Mac.
上安装 openssl 运行 CLion (CMake)用自制软件安装了 openssl
brew install openssl
但是 CLion 仍然无法找到 openssl。过去可以使用
brew link openssl
不过今天好像homebrew拒绝了。
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
然后我在 CLion 中使用了以下 cmake 选项 (CMakeLists.txt)
set(I "/usr/local/opt/openssl/include")
set(L "/usr/local/opt/openssl/lib")
include_directories(${I})
但我仍然得到:
Undefined symbols for architecture x86_64:
"_EVP_DigestSignFinal", referenced from:
Undefined symbols for architecture x86_64:
"_EVP_DigestSignFinal", referenced from:
OpenSSL::signMsg(Buffer, Buffer, SignOptions) in libMyLib.a(ssl_state.cpp.o)
OpenSSL::signMsg(Buffer, Buffer, SignOptions) in libMyLib.a(ssl_state.cpp.o)
我能找到的关于这个主题的几乎所有内容都是关于旧版本的 macOS,但 Apple 已经从 openssl 0.9.8 中删除了 development-headers,因此许多指南不再有效。
这似乎是链接的问题。我正在使用 Macports 而不是 Homebrew,但也在 MacOS Sierra 上使用。
因为我看不到你的代码并且你没有提供最低工作示例,所以我使用了:https://github.com/Andersbakken/openssl-examples.git
和你一样,我在CMakeLists.txt
set(I "/opt/local/include")
set(L "/opt/local/lib")
include_directories(${I})
对我来说效果很好:
cmake .
make
您是否验证过,必要的文件实际上在路径下可用,您输入 CMakeLists.txt
?
你试过了吗:
brew info openssl