Wouter de Bie wrote: > Gavin Morrice wrote: >> Actually - scrap that >> >> I just tried adding ENV['LD_LIBRARY_PATH']="/usr/local/lib:#{ENV >> ['LD_LIBRARY_PATH']}" >> to the environment.rb file >> >> This doesn't seem to work >> >> I also added puts ENV['LD_LIBRARY_PATH'] to see if it recognised >> LD_LIBRARY_PATH > > I think that LD_LIBRARY_PATH is not loaded by the application itself, > but by it's loader (part of the operating system). Setting this variable > when the application is already started doesn't work. The loader should > be instructed to load certain libs which (afaik) can only be done by > setting the variable before you start the app. This can be done by > setting it from a .bashrc or .profile (depending on your shell). Note > that these scripts are only used when starting a login shell. A better > way would be to create a shell script that loads the libs first and then > starts your server. > >> Any ideas on how I can access this from the environment.rb file? >> >> Also, could you please explain why adding the path to .bash_profile is >> not best practice? This seems to do the trick, at least through the >> console. > > If it works, it works :) But if you deploy it under a different user, it > breaks. E.g. if you deploy it with phusion passenger and apache, the > user that runs apache should have the path set. You could set this > globally in /etc/ld.so.conf.
LD_LIBRARY_PATH may not be resampled each time a library is loaded. I'm not sure. The loader uses it but it gets it from the processes environment. The question is when. The definitive test is does it work after a reboot and the application is automatically deployed by whatever scripts and daemons deploy it. As mentioned, there is usually a script involved somewhere in that process. I would add it to that script and keep that script somewhere in the project (under the project's SCM) so they are "tied" together. The problem you are trying to solve by doing this is to leave yourself bread crumbs so when it breaks again in the future, you can retrace your steps and remember "Oh yea! I need to change my load path" HTH -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---