LoadError:dlopen(digest/sha1.bundle):找不到符号:_rb_Digest_SHA1_Finish

Posted

技术标签:

【中文标题】LoadError:dlopen(digest/sha1.bundle):找不到符号:_rb_Digest_SHA1_Finish【英文标题】:LoadError: dlopen(digest/sha1.bundle): Symbol not found: _rb_Digest_SHA1_Finish 【发布时间】:2013-02-19 12:33:02 【问题描述】:

Ruby 最近停止在我兄弟的机器上工作。

gem 命令 rails server rails console

全部失败,出现以下错误:

$ irb
irb(main):001:0> require 'digest/sha1'

LoadError: dlopen(~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish
  Referenced from: ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle
  Expected in: flat namespace

 in ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle - ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.2.0/digest/sha1.bundle
    from ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from ~/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from (irb):1
    from ~/.rbenv/versions/2.0.0-p0/bin/irb:12:in `<main>'

他尝试了不同版本的 Ruby。使用rvm 重新安装所有内容。运行rvm implode 并重新安装rvm。切换到rbenv。通过ruby-build 安装了几个红宝石。 brew install ruby.

所有人都有同样的问题。

如果他卸载了所有的 rubies,/usr/bin/ruby 中操作系统提供的版本就可以工作。但它是 1.8.7。

经过数小时的故障排除后,我们得出了以下解决方案。我希望它可以帮助您避免一些痛苦。

【问题讨论】:

【参考方案1】:

对于像我这样因为这样的错误而来到这里的任何人:

LoadError: dlopen(/Users/sebkomianos/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method
Referenced from: /Users/sebkomianos/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

一种解决方案 (taken from here) 可能是重新安装您的 ruby​​ 版本。例如:rbenv install 2.0.0-p247

【讨论】:

重新安装 ruby​​ 对我有用。 unset C_INCLUDE_PATH 不是必需的。【参考方案2】:

可能的解决方案:

    $ unset C_INCLUDE_PATH 并重新安装 Ruby

    这是对我有用的解决方案。

    $ echo $C_INCLUDE_PATH

    如果设置了C_INCLUDE_PATH,它将破坏 Ruby 构建。将其从您的环境中移除;暂时使用$ unset C_INCLUDE_PATH,或永久使用(可能在 .bashrc、.profile、.bash_profile 中);然后重新安装红宝石。

    这可能与 OpenSSL、RVM、XCode 的命令行工具 (gcc) 或其他构建问题有关。

    如果之前的解决方案不起作用,请参阅this answer。

【讨论】:

以上是关于LoadError:dlopen(digest/sha1.bundle):找不到符号:_rb_Digest_SHA1_Finish的主要内容,如果未能解决你的问题,请参考以下文章

M1(Apple Silicon)上的 CocoaPods 因 ffi 架构错误而失败

无法加载此类文件 -- openssl (LoadError)

Cocoapods:LoadError - 没有要加载的文件

请从 Capistrano 配方中获取此文件 (LoadError)

LoadError:无法加载“听”gem(Rails 5)

`require': 没有要加载的文件 -- mkmf (LoadError)