sqlite3-ruby: Unable to find libsqlite3.so at runtime

Discussion in 'Ruby' started by Lars Olsson, Nov 11, 2005.

  1. Lars Olsson

    Lars Olsson Guest

    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
    Lars Olsson, Nov 11, 2005
    #1
    1. Advertising

  2. Lars Olsson

    Guest

    Cit=E1t Lars Olsson <>:

    > 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.
    >=20
    > Some details on my setup:
    >=20
    > "Normal" Ruby (setup by my ISP, I don't use it) lives in /usr
    > (/usr/bin, /usr/lib etc.)
    >=20
    > My custom-built Ruby lives in /home/username/custom
    > (/home/username/custom/bin, /home/username/custom/lib etc.)
    >=20
    > My custom-built SQLite lives in /home/username/custom
    > (/home/username/custom/bin, /home/username/custom/lib etc.)
    >=20
    > 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=3D/home/username/custom/include
    > --with-sqlite3-lib=3D/home/username/custom/include
    > The gem seems to find everything it needs to install.
    >=20
    > 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.
    >=20
    > 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?
    >=20
    >=20
    > Any suggestions help be most appreciated.
    >=20
    >=20
    > Kindly
    >=20
    > /Lasso
    >=20
    >=20
    >=20



    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 c=
    ase.
    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, u=
    se 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.
    , Nov 11, 2005
    #2
    1. Advertising

  3. Hi,

    At Fri, 11 Nov 2005 16:42:14 +0900,
    Lars Olsson wrote in [ruby-talk:165273]:
    > 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?


    The option --enable-rpath for configure may work.

    --
    Nobu Nakada
    nobuyoshi nakada, Nov 11, 2005
    #3
  4. Lars Olsson

    Ara.T.Howard Guest

    On Fri, 11 Nov 2005, Lars Olsson wrote:

    > 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.


    all you need to do is

    export LD_RUN_PATH=/home/username/custom/lib

    __before__ compiling and you'll not need to use LD_LIBRARY_PATH.

    in general, if installing into a non-standard place like that, follow these
    instructions for __everything__ that you compile

    export LD_RUN_PATH=/home/username/custom/lib:$LD_RUN_PATH
    export LD_LIBRARY_PATH=/home/username/custom/lib:$LD_LIBRARY_PATH
    ./configure --prefix=/home/username/custom && make && make install

    anyone who does this for ruby, extensions, and other libraries will by
    suprised to find that everything just works - no matter what platform you are
    on or what package manager might exist.

    regards.

    -a
    --
    ===============================================================================
    | ara [dot] t [dot] howard [at] gmail [dot] com
    | all happiness comes from the desire for others to be happy. all misery
    | comes from the desire for oneself to be happy.
    | -- bodhicaryavatara
    ===============================================================================
    Ara.T.Howard, Nov 11, 2005
    #4
  5. Lars Olsson

    Lars Olsson Guest

    Ara.T.Howard skrev:
    > On Fri, 11 Nov 2005, Lars Olsson wrote:
    >
    >
    >
    > all you need to do is
    >
    > export LD_RUN_PATH=/home/username/custom/lib
    >
    > __before__ compiling and you'll not need to use LD_LIBRARY_PATH.
    >
    > in general, if installing into a non-standard place like that, follow these
    > instructions for __everything__ that you compile
    >
    > export LD_RUN_PATH=/home/username/custom/lib:$LD_RUN_PATH
    > export LD_LIBRARY_PATH=/home/username/custom/lib:$LD_LIBRARY_PATH
    > ./configure --prefix=/home/username/custom && make && make install
    >
    > anyone who does this for ruby, extensions, and other libraries will by
    > suprised to find that everything just works - no matter what platform
    > you are
    > on or what package manager might exist.
    >
    > regards.
    >
    > -a


    *whoa* black ld magic...but it works :)

    thanks for helping out!


    /Lasso
    Lars Olsson, Nov 11, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kurda Yon
    Replies:
    16
    Views:
    712
    Kurda Yon
    Nov 7, 2008
  2. Wybo Dekker
    Replies:
    1
    Views:
    330
    Yukihiro Matsumoto
    Nov 15, 2005
  3. Jeffrey 'jf' Lim
    Replies:
    5
    Views:
    468
    Jeffrey 'jf' Lim
    Apr 9, 2007
  4. Manish Kalra
    Replies:
    2
    Views:
    85
    _-_ Daniel _-_
    Dec 2, 2008
  5. SunSw0rd
    Replies:
    4
    Views:
    245
    SunSw0rd
    Jul 2, 2009
Loading...

Share This Page