views:

405

answers:

3

I'm having trouble getting a rails app on Dreamhost's Passenger to see compiled libraries in my ~/opt/lib directory. I have to put them here because I don't have root access.

I can boot up my app in ./script/console and it sees them libraries just fine because I updated my .bash_profile's LD_LIBRARY_PATH environment variable to include ~/opt/lib.

I've tried putting ENV['LD_LIBRARY_PATH'] = '~/opt/lib' in my environment.rb file but it doesn't seem too help. I get the following error from Passenger when I navigate to my site: libodbcinst.so.1: cannot open shared object file: No such file or directory - /home/username/opt/lib/odbc.so

Anyone have experience with this?

Thanks

+1  A: 

I had similar issue with Passenger that I described in http://blog.rayapps.com/2008/05/21/using-mod_rails-with-rails-applications-on-oracle/

But in your case this migth not work as you will not be able to change Dreamhost's httpd.conf file.

Other thing that you can try is to set LD_LIBRARY_PATH in .bashrc - according to http://www.wavethenavel.com/jonathanpenn/2008/09/08/bootstrapping-a-dreamhost-account-for-rails-and-git/ this has worked in Dreamhost's case. Have not verified that Passenger will execute .bashrc before launching ruby.

Raimonds Simanovskis
+1  A: 

Using .bashrc won't work, as the library path that Passenger uses is the one that Apache loads on boot. There is no way it would look at a user's directory as that would be a major security issue.

aussiegeek
A: 

The environment.rb way sounds like the way to go, though you might want to append to LD_LIBRARY_PATH instead. Also I'd make sure to use the full path to that directory just in case.

Alternatively you might be able to use .htaccess directives, similar to what is described @ http://wiki.rubyonrails.org/rails/pages/HowToUseOracleWithFastCGI

sammich