Macos 自制拒绝链接OpenSSL
我在:OSX 10.11.6,自制版本0.9.9m OpenSSL 0.9.8zg 2015年7月14日 我试着与dotnetcore一起玩,通过遵循他们的 我已升级/安装了最新版本的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
> 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链接——强制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后,您需要重新启动交互式会话(即关闭控制台并启动另一个会话)。这些解决方案在OS X El Capitan 10.11.6上都不适用于我。可能是因为OSX有一个它认为优越的openssl本机版本,因此不喜欢篡改 所以,我走了这条大路,重新开始
手动安装和符号链接
- 如果您得到的是“没有这样的文件或目录”,请执行以下操作:
cd/usr/local&&mkdir-src&&cd-src
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
在尝试了我能找到的所有东西后,什么都不起作用,我只是尝试了这个:
touch ~/.bash_profile; open ~/.bash_profile
在文件中添加了这一行
export PATH="$PATH:/usr/local/Cellar/openssl/1.0.2j/bin/openssl"
现在它起作用了:)
这就是我的工作原理:
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/
ln -s /usr/local/Cellar/openssl/1.0.2j/bin/openssl /usr/local/bin/openssl
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
感谢@dorlandode在这条线上
注意:在我能够花时间从头开始正确安装Openssl之前,我只是将此用作临时修复。我记得,在我意识到最好的方法是一个接一个地手动安装我需要的证书之前,我花了一天中最长的时间调试和出现问题。在尝试此操作之前,请阅读@bouke评论中的链接。我有一个类似的案例。我需要通过brew安装openssl,然后使用pip安装mitmproxy。我从
brew链接--force收到同样的投诉。以下是我达成的解决方案:(不使用brew的强制链接)
这并没有直截了当地解决这个问题。我留下一行代码,以防有人使用pip并需要openssl库
注意:/usr/local/opt/openssl/lib
路径是通过brew info openssl
获取的,只需执行brew info openssl
并阅读其中的信息:
如果需要先在路径中运行此软件:echo'export PATH=“/usr/local/opt/openssl/bin:$PATH”>>~/.bash\u profile
这对我很有用:
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/
ln -s /usr/local/Cellar/openssl/1.0.2j/bin/openssl /usr/local/bin/openssl
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
以上来自爱德华第二次世界大战的解决方案在塞拉山也对我有效
brew install openssl
cd /usr/local/include
ln -s ../opt/openssl/include/openssl
./configure && make
我以前采取的其他步骤包括:
- 通过brew安装openssl
brew install openssl
- 按照自制的建议将openssl添加到路径
brew info openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
如果迁移mac会破坏自制程序:
我迁移了我的mac电脑,它解除了我所有自制软件安装的链接——包括OpenSSL。这破坏了gem安装
,这就是我第一次注意到这个问题并开始尝试修复它的原因
经过一百万个解决方案(当迁移到OSX Sierra-10.12.5时),解决方案最终变得非常简单:
brew reinstall ruby
brew reinstall openssl
对我来说,这是有效的
我编辑了./bash_配置文件并添加了以下命令
export PATH=“/usr/local/opt/openssl/bin:$PATH”我在尝试安装更新版本的ruby 2.6.5时遇到了相同的问题
帮助我解决这个问题。这适用于macOS catalina版本10.15.1
基本上,我做了更新和升级
自制,安装了openssl,安装了ruby
brew update && brew upgrade
brew install openssl
然后创建这2个符号链接
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/
然后安装ruby 2.6.5导出https\u代理=http://127.0.0.1:1087 http_代理=http://127.0.0.1:1087 all_proxy=socks5://127.0.0.1:1080
为我工作
我认为它可以解决所有的问题,比如
无法连接到raw.githubusercontent.com端口443:连接被拒绝
默认情况下,homebrew为我提供了OpenSSL版本1.1,我是l
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