Why require mongo gives me LoadError: no such file to load — openssl

前端 未结 1 2016
庸人自扰
庸人自扰 2021-01-05 02:41

I\'m using Ubuntu Server 10, Ruby 1.9.2

When I try to require \'mongo\'

it gives me this error:

irb(main):001:0> require \'mongo\'
LoadErr         


        
相关标签:
1条回答
  • 2021-01-05 03:16

    You need two things: OpenSSL itself and the ruby bindings for OpenSSL. The first part is as Yossi said:

    sudo apt-get install libssl
    

    The second depends on how you install ruby. I'm guessing from the paths in your question that you compiled ruby from source. In which case you first need to make sure you have then openssl headers:

    sudo apt-get install libssl-dev
    

    then it should be picked up automatically when you compile ruby. If you do not want to recompile ruby, the you should be able to build the OpenSSL bindings by

    • cd to the folder containing the ruby source
    • cd to ext/openssl
    • ruby extconf.rb
    • make && sudo make install
    0 讨论(0)
提交回复
热议问题