Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby can't find psych.so despite it existing

After installing Rails with rvm, I was faced with the following error:

/afs/andrew.cmu.edu/usr11/kvudata/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/yaml.rb:56:in '<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

So to get a little more information, I went irb and tried to require 'psych':

1.9.3-p327 :001 > require 'psych'
LoadError: libyaml-0.so.2: cannot open shared object file: No such file or directory -/afs/andrew.cmu.edu/usr11/kvudata/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/x86_64-linux/psych.so

But when I navigate to the specified location where it's trying to find psych.so, it exists!

I have tried uninstalling ruby and reinstalling as well as uninstalling, compiling libyaml from source, and then reinstalling ruby, but to no avail, the error doesn't go away.

like image 570
krishonadish Avatar asked Nov 15 '25 19:11

krishonadish


1 Answers

This doesn't feel like a "real" solution, but I was able to get things working.

In my case, libyaml is installed in /usr/local/lib. Adding that path to my environment variables did the trick (inspired by Shared Libraries). I added the following to my .bash_profile

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

For other visitors who - like me - are trying to make this work with capistrano, adding this to my deploy.rb worked:

set :default_environment, {'LD_LIBRARY_PATH' => '/usr/local/lib'}

I look forward to more informed suggestions.

like image 83
Arian Ryan Avatar answered Nov 17 '25 17:11

Arian Ryan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!