Cit?t Lars Olsson <lasso / lassoweb.nu>:

> Hi, I've custom-built both Ruby and SQLite on a shared Debian box but
> I'm having some problems getting sqlite3-ruby to work correctly. It
> seems to install OK, but the lib seems unable to find libsqlite3.so at
> runtime.
> 
> Some details on my setup:
> 
> "Normal" Ruby (setup by my ISP, I don't use it) lives in /usr
> (/usr/bin, /usr/lib etc.)
> 
> My custom-built Ruby lives in /home/username/custom
> (/home/username/custom/bin, /home/username/custom/lib etc.)
> 
> My custom-built SQLite lives in /home/username/custom
> (/home/username/custom/bin, /home/username/custom/lib etc.)
> 
> When I install sqlite3-ruby as a gem I have specified the location of
> the sqlite3 headers and libs
> gem install sqlite3-ruby --remote --
> --with-sqlite3-include=/home/username/custom/include
> --with-sqlite3-lib=/home/username/custom/include
> The gem seems to find everything it needs to install.
> 
> At runtime, sqlite3-ruby cannot find libsqlite3.so unless I explicitly
> set the LD_LIBRARY_PATH environment variable to point at
> /home/username/custom/lib.
> 
> Is it possible to let sqlite3-ruby know where to find libsqlite3.so
> without using LD_LIBRARY_PATH? Is it possible to set it
> when compiling Ruby or installing the gem?
> 
> 
> Any suggestions help be most appreciated.
> 
> 
> Kindly
> 
> /Lasso
> 
> 
> 


Hmm. Being a complete newbie at things Unix, I've no idea how the dynamic linker
works there, but odds are you can't dlopen() a shared library without it being
in a well-known place. A well known place in this case being someplace in
LD_LIBRARY_PATH. Or at least not without hacking Ruby internals in this case.
Or, as a quick google would suggest, relinking Ruby to look for shared
libraries in your custom library folder.

If you mind having libsqlite3 in the environment variable all the time, use a
script to temporarily set the environment variable for the ruby session, that
might work.

David Vallner

PS: Any information from someone -not- wildly guessing would be very much
appreciated.