使用openssl.so的Rails LoadError:未定义的符号:d2i_ECPKParameters

时间:2012-03-16 05:52:46

标签: ruby-on-rails openssl

rails --version

Rails 3.2.1

ruby​​ -v

ruby​​ 1.9.3p0(2011-10-30)[x86_64-linux]

rpm -qa | grep openssl

的OpenSSL 0.9.8e-20.el5 OpenSSL的-devel的-0.9.8e-20.el5 OpenSSL的-0.9.8e-20.el5

uname -a

Linux 2.6.18-274.7.1.el5#1 SMP Mon Oct 17 11:57:14 EDT 2011 x86_64 x86_64 x86_64 GNU / Linux

rails new blog

  create  
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/images/rails.png
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/mailers
  create  app/models
  create  app/views/layouts/application.html.erb
  create  app/mailers/.gitkeep
  create  app/models/.gitkeep
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  doc
  create  doc/README_FOR_APP
  create  lib
  create  lib/tasks
  create  lib/tasks/.gitkeep
  create  lib/assets
  create  lib/assets/.gitkeep
  create  log
  create  log/.gitkeep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/index.html
  create  public/robots.txt
  create  script
  create  script/rails
  create  test/fixtures
  create  test/fixtures/.gitkeep
  create  test/functional
  create  test/functional/.gitkeep
  create  test/integration
  create  test/integration/.gitkeep
  create  test/unit
  create  test/unit/.gitkeep
  create  test/performance/browsing_test.rb
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.gitkeep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.gitkeep
  create  vendor/plugins
  create  vendor/plugins/.gitkeep
     run  bundle install
/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': /usr/local/lib/ruby/1.9.1/x86_64-linux/openssl.so: undefined symbol: d2i_ECPKParameters - /usr/local/lib/ruby/1.9.1/x86_64-linux/openssl.so (LoadError)
    from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/lib/ruby/1.9.1/openssl.rb:17:in `<top (required)>'
    from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/lib/ruby/1.9.1/net/https.rb:22:in `<top (required)>'
    from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/lib/ruby/1.9.1/rubygems/remote_fetcher.rb:316:in `connection_for'
    from /usr/local/lib/ruby/1.9.1/rubygems/remote_fetcher.rb:368:in `request'
    from /usr/local/lib/ruby/1.9.1/rubygems/remote_fetcher.rb:203:in `fetch_http'
    from /usr/local/lib/ruby/1.9.1/rubygems/remote_fetcher.rb:231:in `fetch_path'
    from /usr/local/lib/ruby/1.9.1/rubygems/spec_fetcher.rb:265:in `load_specs'
    from /usr/local/lib/ruby/1.9.1/rubygems/spec_fetcher.rb:231:in `block in list'
    from /usr/local/lib/ruby/1.9.1/rubygems/spec_fetcher.rb:227:in `each'
    from /usr/local/lib/ruby/1.9.1/rubygems/spec_fetcher.rb:227:in `list'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:253:in `fetch_all_remote_specs'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:234:in `block in remote_specs'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:231:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:231:in `remote_specs'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:165:in `fetch_specs'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:70:in `specs'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:176:in `block (2 levels) in index'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in `block in index'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/index.rb:7:in `build'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:174:in `index'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:168:in `resolve'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:107:in `specs'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:102:in `resolve_remotely!'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/installer.rb:43:in `run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/installer.rb:8:in `install'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in `install'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/bin/bundle:13:in `<main>'
Fetching source index for https://rubygems.org/

3 个答案:

答案 0 :(得分:11)

如果在安装ruby之前未安装openssl,则会出现此问题。有两个修复:

  1. (建议修复)安装openssl,然后重新编译您的ruby版本。假设您正在使用rvm,您可以通过执行以下操作来解决此问题:rvm pkg install openssl然后rvm remove 1.9.3然后rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr使用openssl编译ruby。

  2. 修改您的Gemfile以说出source "http://rubygems.org"而不是source "https://rubygems.org"

  3. 选项2更快更容易,但将来更有可能引发问题。

答案 1 :(得分:2)

rvm pkg已被弃用。

如果您运行的是最新版本的rvm(例如1.21),请尝试此操作:

rvm autolibs enable
rvm reinstall <ruby>

<ruby>是您正在使用的ruby版本。 (例如rvm重新安装1.9.3)

重新安装ruby之后,请检查.ruby-version文件(替换最新版本的rvm中的.rvmrc)并确保将其设置为新版本的ruby。

我最终删除了gemset并在一切正常工作之前重新创建它。

答案 2 :(得分:0)

我有同样的问题,但环境不同。默认情况下已安装Openssl工具。 Ruby 1.9.2p320也默认安装在/ usr / local,我使用rbenv在自定义位置安装其他rubies。使用Rails与rbenv的ruby 1.8.7及其openssl生成未定义的符号:d2i_ECPKParameters错误。

要修复它,我覆盖了我的系统默认ruby并将ruby 1.8.7安装到/ usr / local并安装了它 openssl via:

# after installing ruby 1.8.7 to /usr/local
# make sure the recent install ruby 1.8.7 is the default ruby
cd ruby-1.8.7-pXXX/ext/openssl
ruby extconf.rb
make
make install

然后我创建了一个符号链接,从最近安装openssl.so在/ usr / local到我的rbenv的ruby 1.8.7的lib / ruby​​ / site_ruby / 1.8 / x86_64-linux / openssl.so

Rails启动时不再出现d2i_ECPKParameters错误。