gpt4 book ai didi

ruby - 为什么需要 mongo 给我 LoadError : no such file to load -- openssl

转载 作者:数据小太阳 更新时间:2023-10-29 06:53:32 26 4
gpt4 key购买 nike

我正在使用 Ubuntu Server 10,Ruby 1.9.2

当我尝试要求'mongo'时

它给我这个错误:

irb(main):001:0> require 'mongo'
LoadError: no such file to load -- openssl
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.5.2/lib/mongo/util/ssl_socket.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/mongo-1.5.2/lib/mongo.rb:63:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from (irb):1
from /usr/local/bin/irb:12:in `<main>'

最佳答案

您需要两件事:OpenSSL 本身和 OpenSSL 的 ruby​​ 绑定(bind)。第一部分正如 Yossi 所说:

sudo apt-get install libssl

第二个取决于您如何安装 ruby​​。我从你问题中的路径猜测你是从源代码编译 ruby​​ 的。在这种情况下,您首先需要确保您拥有 openssl header :

sudo apt-get install libssl-dev

那么当你编译 ruby​​ 时它应该被自动拾取。如果您不想重新编译 ruby​​,您应该能够通过以下方式构建 OpenSSL 绑定(bind)

  • cd 到包含 ruby​​ 源的文件夹
  • cd 到 ext/openssl
  • ruby extconf.rb
  • make && sudo make install

关于ruby - 为什么需要 mongo 给我 LoadError : no such file to load -- openssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8642368/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com