This discussion is archived
4 Replies Latest reply: Feb 9, 2012 6:11 AM by biberdorf RSS

Best way to configure library location

biberdorf Newbie
Currently Being Moderated
The documentation for the Instant Client repeatedly suggests using LD_LIBRARY_PATH as the way to specify the location of the IC libraries on Unix/Linux systems. However, I know more than a few system administrators (to say nothing of our build team) that cringe at that suggestion.

We're trying to ship the Instant Client with our application, while limiting use of the client we install to our application. If it weren't for this fact, I'd suggest adding it to /etc/ld.so.conf and running ldconfig. However, that'll register the libraries across the system. Is there any other way to isolate use of the IC libraries without using LD_LIBRARY_PATH ?
  • 1. Re: Best way to configure library location
    AndyKlock Journeyer
    Currently Being Moderated
    If you are shipping the instant client with your application, why don't you just have your application set the LD_LIBRARY_PATH if it needs it?
  • 2. Re: Best way to configure library location
    biberdorf Newbie
    Currently Being Moderated
    That's the approach currently under consideration.

    I'm more concerned about the sort of issues described at
    [Oracle Solaris blog: avoiding the LD_LIBRARY_PATH|[http://blogs.oracle.com/ali/entry/avoiding_ld_library_path_the]
    and
    [Why LD_LIBRARY_PATH is bad|http://xahlee.org/UnixResource_dir/_/ldpath.html]

    There's not a lot of guidance in the Instant Client documentation. The regular Oracle Client seems to bypass this problem generally by defining ORACLE_HOME and the like plus including $ORACLE_HOME/bin in the PATH.

    Edited by: biberdorf on Feb 8, 2012 1:08 PM

    Edited by: biberdorf on Feb 8, 2012 1:09 PM
  • 3. Re: Best way to configure library location
    LaurenzAlbe Journeyer
    Currently Being Moderated
    While I agree that globally setting LD_LIBRARY_PATH is a dangerous thing (and even carelessly modifying /etc/ld.so.conf can be a problem), I think that it is no problem in the case of Oracle Instant Client unless you have several Oracle installations on one machine because there is hardly any danger of library name collision.
    That said, I guess that you cannot guarantee that your customers don't have other Oracle software installed on the machine :^)

    I see two good ways for you:
    1) If Instant Client is always installed in the same path (e.g. if you include it in a non-relocatable RPM), you can link your executable with -rpath <path to Instant Client>.
    2) If that won't work (if the user can select the installation path), start your executable from a wrapper script that sets LD_LIBRARY_PATH only in the environment of the executable.

    Yours,
    Laurenz Albe
  • 4. Re: Best way to configure library location
    biberdorf Newbie
    Currently Being Moderated
    Laurenz,

    Thanks for that additional information. After talking with our build team, I suspect that the second option will be our solution.

    What we want to avoid is doing anything that interferes with any other Oracle software that might be on the system. We'd really like to keep this local to our application.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points