Brew更新破坏了OpenSSL。

huangapple go评论66阅读模式
英文:

Brew update breaks openssl

问题

今天我想通过RVM安装一个新的Ruby版本,但触发了一个Homebrew更新,导致OpenSSL出现了问题。

当我尝试运行RAILS时,我收到了一个与openssl相关的错误:

brew info openssl 给了我以下信息:

一些方法可以帮助你以正确的方式运行它:

  1. 删除旧版本的OpenSSL:首先,你可以尝试删除旧版本的OpenSSL,以避免混淆。运行以下命令:
brew uninstall openssl

这将卸载旧版本的OpenSSL。

  1. 更新RVM:确保你的RVM也是最新的。运行以下命令来更新RVM:
rvm get stable
  1. 重新安装Ruby:现在,你可以尝试重新安装你的Ruby版本。运行以下命令:
rvm install 2.7

这应该会使用最新版本的OpenSSL来编译Ruby。

  1. 更新依赖路径:如果你仍然遇到问题,你可以尝试更新依赖路径。在你的终端中运行以下命令:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

这将确保编译和运行时能够正确找到OpenSSL。

希望这些步骤可以帮助你以正确的方式运行Ruby和RAILS。如果你仍然遇到问题,请提供更多详细信息,以便我能够提供更多帮助。

英文:

today I wanted to install a new Ruby version through RVM and a homebrew update was triggered which broke OpenSSL.

[~]$ rvm install 2.7
.
.
.
No binary rubies available for: osx/10.14/x86_64/ruby-2.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Auto-updated Homebrew!
Updated Homebrew from 1ea1f31d0 to c0b916764.
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).
.
.
.
==> Upgrading 4 outdated packages:
coreutils 8.30_2 -> 8.31
libyaml 0.2.1 -> 0.2.2
openssl@1.1 1.1.1a -> 1.1.1d
readline 8.0.0 -> 8.0.1
==> Upgrading openssl@1.1 
==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a60359a28a02d480d85a959e6141394b0571cbb28?__gda__=exp=1578044774~hmac=a692626c1c5fbcfeb1077551a60292afc273163879d04dc708c6051d0fc02d5a&response-content-disposition=attachment%3Bfilename%3D%22openssl%401.1
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1d.mojave.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@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1d: 7,983 files, 17.9MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /usr/local/Cellar/openssl@1.1/1.1.1a... (7,953 files, 17.9MB)
Removing: /Users/MyAccount/Library/Logs/Homebrew/libdvdcss... (64B)
Pruned 0 symbolic links and 2 directories from /usr/local

When I try to run RAILS I get an openssl connected error:

[~]$ rails s
/Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle: dlopen(/Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle/openssl.bundle
  Reason: image not found - /Users/MyAccount/.rvm/rubies/ruby-x/lib/ruby/x/..../openssl.bundle/openssl.bundle

brew info openssl gives me:

[~]$ brew info openssl
openssl@1.1: stable 1.1.1d (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1a (7,953 files, 17.9MB)
  Poured from bottle on 2019-02-11 at 09:38:06
/usr/local/Cellar/openssl@1.1/1.1.1d (7,983 files, 17.9MB)
  Poured from bottle on 2020-01-03 at 15:15:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl@1.1.rb
==> 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@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

Somehow I have two openssl formulas installed in brew: openssl and openssl@1.1. Where openssl has version 1.0.2q and openssl@1.1 versions 1.1.1a and 1.1.1d.

In my .bash_profile I have configured the path:

### Customize path for openssl
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"

Somehow I am unable to use the upgraded version of openssl: no way to update RVM, reinstall ruby, run rails. The only way I was able get it working is to delete the content of

/usr/local/Cellar/openssl@1.1/1.1.1d 

and copy instead the content of

/usr/local/Cellar/openssl/1.0.2q 

inside.

How can I get it running in a proper way?

Thank you in advance!!!

答案1

得分: 6

感谢brew.sh上的讨论页面的帮助,我能够找到我的问题的原因。

brew及其公式的自动更新不仅覆盖了openssl@1.1的符号链接,还覆盖了/usr/local/opt中的通用openssl链接。现在它们都指向了/usr/local/Cellar/openssl@1.1,而在我的第二个开发系统上,openssl符号链接仍然指向/usr/local/Cellar/openssl

在我重新创建了/usr/local/Cellar/openssl的openssl符号链接之后,一切又恢复正常了。

背景是,openssl 1.1是最安全的版本,而1.0据我所知已经被弃用。但在我的情况下,这仅用于维护一个正在开发中的旧项目。

现在,在每次brew更新/升级后,我还要做一件事情:验证符号链接,因为最近引入的自动清除旧版本已经迫使我从备份中将它们复制回我的系统。

英文:

Thanks to help from the discourse page on brew.sh I was able to find the cause of my problem.

The automatic update of brew and its formulas had overwritten not only the symlink for openssl@1.1 but also the generic openssl link in /usr/local/opt. Both pointed now to /usr/local/Cellar/openssl@1.1, whereas on my second dev system the openssl symlink pointed still to /usr/local/Cellar/openssl.

After I recreated the openssl symlink for /usr/local/Cellar/openssl everything works again.

The context is that openssl 1.1 is the safest version whereas 1.0 has been deprecated to my knowledge. But in my case it is only to maintain a legacy project in development.

Now I will have one more thing to do after every brew update/upgrade: verify symlinks, after the recent introduction of auto purging of old versions already forces me to copy them back into my system from a backup.

huangapple
  • 本文由 发表于 2020年1月4日 01:48:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/59583075.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定