require': libsndfile.so.1: cannot open shared object file
I can use ruby-audio perfectly fine on my dev machine (mac os x lion). However, on amazon ec2 (rhel), after bundle installing the gem successfully, I get the following error when trying to start my app:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/ruby-audio-1.6.1/lib/ruby-audio.rb:6:in require': libsndfile.so.1: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-1.9.3-p194/gems/ruby-audio-1.6.1/lib/rubyaudio_ext.so (LoadError) from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/ruby-audio-1.6.1/lib/ruby-audio.rb:6:inrescue in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/ruby-audio-1.6.1/lib/ruby-audio.rb:1:in <top (required)>' from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:inrequire'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in block (2 levels) in require' from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:ineach'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in block in require' from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:ineach'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in require' from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler.rb:128:inrequire'
from /var/www/anrthis_staging/releases/20130107020957/config/application.rb:7:in <top (required)>' from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:39:inrequire'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:39:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `
Any ideas what could be the cause for this?
Thanks.
Do you know where it is trying to find libsndfile.so.1? If I know that location, then I can try to add a symlink there and point it to where that file actually exists. These are the files I have on my machine (libsndfile.so.1 clearly exists):
/usr/local/lib/libsndfile.so /usr/local/lib/libsndfile.a /usr/local/lib/libsndfile.so.1 /usr/local/lib/libsndfile.la /usr/local/lib/libsndfile.so.1.0.25 /usr/local/share/doc/libsndfile1-dev /usr/local/share/doc/libsndfile1-dev/html/libsndfile.jpg /usr/local/share/doc/libsndfile1-dev/html/libsndfile.css
If you are using a publicly available AMI, I can check and see if the libsndfile package is installed in a non-standard location. Otherwise, it looks for libsndfile-1.so or libsndfile.so in ['/opt/local/lib', '/usr/local/lib'].
I'm using Ubuntu 16. libsndfile is not install to that dir.
It is only installing as an .so.
I tried this, but no luck.
gem install ruby-audio -- --with-sndfile-lib=/usr/lib/x86_64-linux-gnu/libsndfile.so.1
find /usr -name 'libsndfile*'
/usr/share/doc/libsndfile1
/usr/lib/x86_64-linux-gnu/libsndfile.so.1
/usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
This worked for me:
gem install ruby-audio -- --with-sndfile-dir=$(brew --prefix libsndfile)