Rails LoadError with openssl.so: undefined symbol: d2i_ECPKParameters

后端 未结 3 1233
遇见更好的自我
遇见更好的自我 2021-01-07 11:21

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 opens

相关标签:
3条回答
  • 2021-01-07 11:52

    I had the same problem, but with a different environment. Openssl tool was already installed by default. Ruby 1.9.2p320 was also installed by default at /usr/local and I was using rbenv installing other rubies at a custom location. Using Rails with the rbenv's ruby 1.8.7 and its openssl produced the undefined symbol: d2i_ECPKParameters error.

    To fix it, I overrode my system default ruby and installed ruby 1.8.7 to /usr/local and installed its 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
    

    Then I created a symbolic link from the recent install openssl.so in /usr/local to my rbenv's ruby 1.8.7's lib/ruby/site_ruby/1.8/x86_64-linux/openssl.so

    Rails started up with no more d2i_ECPKParameters error.

    0 讨论(0)
  • 2021-01-07 11:58

    This problem arises when you don't install openssl prior to installing ruby. There are two fixes:

    1. (Suggested fix) Install openssl and then recompile your version of ruby. Assuming you are using rvm, you can solve this by doing: rvm pkg install openssl then rvm remove 1.9.3 then rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr which compiles ruby with openssl.

    2. Modify your Gemfile to say source "http://rubygems.org" instead of source "https://rubygems.org"

    Option 2 is quicker and easier, but more likely to cause problems in the future.

    0 讨论(0)
  • 2021-01-07 12:08

    rvm pkg has been deprecated.

    Instead try this if you are running the latest version of rvm (e.g. 1.21):

    rvm autolibs enable
    rvm reinstall <ruby>
    

    Where <ruby> is the version of ruby you are using. (e.g. rvm reinstall 1.9.3)

    After you reinstall ruby check your .ruby-version file (replaces .rvmrc in latest version of rvm) and ensure it is set to the new version of ruby.

    I ended up removing the gemset and recreating it before everything worked correctly.

    0 讨论(0)
提交回复
热议问题