I'm trying to distribute a version of Ruby along with an application,
and have a dependency on several shared objects that need to be
distributed with it. On Windows, this is no problem: just add the DLLs
to the 'bin' directory from which Ruby is run, and the system picks
them up and loads them as needed.
Under Linux, though, I seem to be completely unable to get Ruby to
recognize the libraries. My file tree looks something like this:
app/
(my sources and data files go here)
ruby/
bin/
ruby
lib/
<somelib>.so
ruby/
1.8/
...
I'm setting LD_RUN_PATH to './ruby/lib', and then launching the Ruby
binary with the flags '-I./ruby/lib/ruby/1.8
-I./ruby/lib/ruby/1.8/i686-linux'. It finds the Ruby libraries and
shared object files just fine, but the <somelib>.so is not being
picked up.
I'm trying to distribute a version of Ruby along with an application,
and have a dependency on several shared objects that need to be
distributed with it. On Windows, this is no problem: just add the DLLs
to the 'bin' directory from which Ruby is run, and the system picks
them up and loads them as needed.
Under Linux, though, I seem to be completely unable to get Ruby to
recognize the libraries. My file tree looks something like this:
app/
(my sources and data files go here)
ruby/
bin/
ruby
lib/
<somelib>.so
ruby/
1.8/
...
I'm setting LD_RUN_PATH to './ruby/lib', and then launching the Ruby
binary with the flags '-I./ruby/lib/ruby/1.8
-I./ruby/lib/ruby/1.8/i686-linux'. It finds the Ruby libraries and
shared object files just fine, but the <somelib>.so is not being
picked up.
* Lennon Day-Reynolds <rcoder@gmail.com> [2004-09-16 03:13:02 +0900]:
I'm trying to distribute a version of Ruby along with an application,
and have a dependency on several shared objects that need to be
distributed with it. On Windows, this is no problem: just add the DLLs
to the 'bin' directory from which Ruby is run, and the system picks
them up and loads them as needed.
Under Linux, though, I seem to be completely unable to get Ruby to
recognize the libraries. My file tree looks something like this:
app/
(my sources and data files go here)
ruby/
bin/
ruby
lib/
<somelib>.so
ruby/
1.8/
...
I'm setting LD_RUN_PATH to './ruby/lib', and then launching the Ruby
binary with the flags '-I./ruby/lib/ruby/1.8
-I./ruby/lib/ruby/1.8/i686-linux'. It finds the Ruby libraries and
shared object files just fine, but the <somelib>.so is not being
picked up.
If you are launching your app with a shell wrapper script then
LD_LIBRARY_PATH is the way to go.
However, if you have a library that loads a .so file, and you don't
control the launching mechanism, then LD_RUN_PATH is what you need.
Now, you would think that you could set LD_LIBRARY_PATH within a
library before you require the lib.so, but this does not work.
Apparently ld does not re-read the environment (or, at least I
don't know how to get it to.)
However, you can set LD_RUN_PATH from the library, and your require
will work.