Macos 自制拒绝链接OpenSSL

Macos 自制拒绝链接OpenSSL,macos,openssl,homebrew,.net-core,Macos,Openssl,Homebrew,.net Core,我在:OSX 10.11.6,自制版本0.9.9m OpenSSL 0.9.8zg 2015年7月14日 我试着与dotnetcore一起玩,通过遵循他们的 我已升级/安装了最新版本的openssl: > brew install openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan.bottle.tar.gz Already downloaded: /User

我在:OSX 10.11.6,自制版本0.9.9m OpenSSL 0.9.8zg 2015年7月14日

我试着与dotnetcore一起玩,通过遵循他们的

我已升级/安装了最新版本的openssl:

> brew install openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
Already downloaded: /Users/administrator/Library/Caches/Homebrew/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Pouring openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, 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

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
但当我尝试链接openssl时,我继续遇到以下链接错误:

> brew link --force openssl
Warning: Refusing to link: openssl
Linking keg-only OpenSSL means you may end up linking against the insecure,
deprecated system version while using the headers from the Homebrew version.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
ln -s /usr/local/Cellar/openssl/1.0.2t/include/openssl /usr/bin/openssl
ln: /usr/bin/openssl: Operation not permitted
包含编译器标志的选项对我来说没有意义,因为我没有编译我所依赖的库

编辑dotnetcore已更新其说明:

brew update    
brew install openssl    
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/    
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

注意:由于以下原因,此选项不再有效

我今天也有同样的问题。我卸载了(未安装)openssl 1.0.2,并用自制软件安装了1.0.1。Dotnet new/restore/run随后运行良好

安装openssl 101:
brew安装自制/versions/openssl101
链接:

brew链接--强制自制/versions/openssl101

注意:由于

我今天也有同样的问题。我卸载了(未安装)openssl 1.0.2,并用自制软件安装了1.0.1。Dotnet new/restore/run随后运行良好

安装openssl 101:
brew安装自制/versions/openssl101
链接:

brew链接——强制homebrew/versions/openssl101

正如对另一个答案的更新所表明的,安装旧openssl101 brew的解决方案将不再有效。有关当前的解决方法,请参见

本期最相关的部分复制于此:

我研究了为在库上设置rpath而建议的另一个选项。我认为下面是一个更好的解决方案,它只会影响这个特定的库

sudo安装名称工具-添加路径/usr/local/opt/openssl/lib/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib

和/或如果已安装NETCore 1.0.1,请对1.0.1执行相同的命令:

sudo安装名称工具-添加路径/usr/local/opt/openssl/lib/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.1/System.Security.Cryptography.Native.dylib

实际上,我们不是告诉操作系统始终使用自制版本的SSL,而是告诉dotnet如何找到正确的库

同样重要的是,看起来微软已经意识到了这个问题,并且有了a)某种程度上的即时缓解计划,以及b)长期解决方案(可能是通过将OpenSSL与dotnet捆绑在一起)

另一件需要注意的事情:
/usr/local/opt/openssl/lib
是默认链接brew的位置:

13:22 $ ls -l /usr/local/opt/openssl
lrwxr-xr-x  1 ben  admin  26 May 15 14:22 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2h_1
如果出于任何原因安装brew并将其链接到其他位置,则该路径应用作rpath


更新System.Security.Cryptography.Native.dylib库的rpath后,您需要重新启动交互式会话(即关闭控制台并启动另一个会话)。

正如对另一个答案的更新所表明的,安装旧openssl101 brew的解决方案将不再有效。有关当前的解决方法,请参见

本期最相关的部分复制于此:

我研究了为在库上设置rpath而建议的另一个选项。我认为下面是一个更好的解决方案,它只会影响这个特定的库

sudo安装名称工具-添加路径/usr/local/opt/openssl/lib/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Security.Cryptography.Native.dylib

和/或如果已安装NETCore 1.0.1,请对1.0.1执行相同的命令:

sudo安装名称工具-添加路径/usr/local/opt/openssl/lib/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.1/System.Security.Cryptography.Native.dylib

实际上,我们不是告诉操作系统始终使用自制版本的SSL,而是告诉dotnet如何找到正确的库

同样重要的是,看起来微软已经意识到了这个问题,并且有了a)某种程度上的即时缓解计划,以及b)长期解决方案(可能是通过将OpenSSL与dotnet捆绑在一起)

另一件需要注意的事情:
/usr/local/opt/openssl/lib
是默认链接brew的位置:

13:22 $ ls -l /usr/local/opt/openssl
lrwxr-xr-x  1 ben  admin  26 May 15 14:22 /usr/local/opt/openssl -> ../Cellar/openssl/1.0.2h_1
如果出于任何原因安装brew并将其链接到其他位置,则该路径应用作rpath


更新System.Security.Cryptography.Native.dylib库的rpath后,您需要重新启动交互式会话(即关闭控制台并启动另一个会话)。

这些解决方案在OS X El Capitan 10.11.6上都不适用于我。可能是因为OSX有一个它认为优越的openssl本机版本,因此不喜欢篡改

所以,我走了这条大路,重新开始


手动安装和符号链接
  • 如果您得到的是“没有这样的文件或目录”,请执行以下操作:

    cd/usr/local&&mkdir-src&&cd-src

下载openssl:

curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
摘录和光盘:

tar -xzvf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
编译并安装:

./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.2h shared
make depend
make
make install
现在,将OS X的openssl链接到新的和更新的openssl:

curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
关闭终端,打开新会话,并验证OS X正在使用新的openssl:

openssl version -a

这些解决方案在OS X El Capitan 10.11.6上对我都不起作用。可能是因为OSX有一个它认为优越的openssl本机版本,因此不喜欢篡改

所以,我走了这条大路,重新开始


手动安装和符号链接
  • 如果您得到的是“没有这样的文件或目录”,请执行以下操作:

    cd/usr/local&&mkdir-src&&cd-src

下载openssl:

curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
摘录和光盘:

tar -xzvf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
编译并安装:

./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.2h shared
make depend
make
make install
现在,将OS X的openssl链接到新的和更新的openssl:

curl --remote-name https://www.openssl.org/source/openssl-1.0.2h.tar.gz
ln -s /usr/local/openssl-1.0.2h/bin/openssl /usr/local/bin/openssl
关闭终端,打开新会话,并验证OS X正在使用新的openssl:

openssl version -a
试过之后
brew update && brew upgrade
brew install openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
ln -s /usr/local/Cellar/openssl/1.0.2t/include/openssl /usr/bin/openssl
ln: /usr/bin/openssl: Operation not permitted
brew switch openssl 1.0.2t
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t