Professional Web Applications Themes

LD_LIBRARY_PATH Behavior - Linux Setup, Configuration & Administration

Hello all, I am not entirely sure which is the correct newsgroup for this, but I will give it a try. How can I get linux to look at the LD_LIBRARY_PATH variable first, and if I do this, will it completely break Linux? Better yet, Can I set a flag that will make it read the LD_LIBRARY_PATH variable before all others for a particular session? I have read some doentation that said that it looked at like the RDPATH or something before LD_LIBRARY_PATH. Any help on this matter would be greatly appreciated. Thanks, mike bautista...

  1. #1

    Default LD_LIBRARY_PATH Behavior

    Hello all,

    I am not entirely sure which is the correct newsgroup for this, but I
    will give it a try.

    How can I get linux to look at the LD_LIBRARY_PATH variable first, and
    if I do this, will it completely break Linux? Better yet, Can I set a
    flag that will make it read the LD_LIBRARY_PATH variable before all
    others for a particular session? I have read some doentation that
    said that it looked at like the RDPATH or something before
    LD_LIBRARY_PATH. Any help on this matter would be greatly
    appreciated.

    Thanks,
    mike bautista

    Mike Bautista Guest

  2. #2

    Default Re: LD_LIBRARY_PATH Behavior

    On Fri, 11 Jul 2003 09:24:00 -0700, Mike Bautista wrote:
    > How can I get linux to look at the LD_LIBRARY_PATH variable first, and
    > if I do this, will it completely break Linux? Better yet, Can I set a
    > flag that will make it read the LD_LIBRARY_PATH variable before all
    > others for a particular session?
    man ld.so

    LD_PRELOAD
    A whitespace-separated list of additional, user-
    specified, ELF shared libraries to be loaded before
    all others. This can be used to selectively over-
    ride functions in other shared libraries. For
    setuid/setgid ELF binaries, only libraries in the
    standard search directories that are also setuid
    will be loaded.

    Dave Uhring Guest

  3. #3

    Default Re: LD_LIBRARY_PATH Behavior

    Thanks for your quick reply Dave. However, I get this now. Perhaps I am
    setting the variable incorrectly. seems like it is trying to force it, but
    when it matter, it still access my sandbox.

    >pls1<: /home/r52652/cvs/projMan/RunEverything1.0/TCL-TK/linux/bin > ldd
    tclsh8.4
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libitcl3.2.so =>
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libitcl3.2.so (0x40015000)
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libitk3.2.so =>
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libitk3.2.so (0x4002e000)
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libtcl8.4.so =>
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libtcl8.4.so (0x40038000)
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libtk8.4.so =>
    /projMan/RunEverything1.0/TCL-TK/linux/lib/libtk8.4.so (0x400d1000)
    libtcl8.4.so =>
    /home/r52652/cvs/projMan/RunEverything1.0/TCL-TK/linux/lib/libtcl8.4.so
    (0x40191000)
    libdl.so.2 => /lib/libdl.so.2 (0x4022a000)
    libm.so.6 => /lib/libm.so.6 (0x4022e000)
    libc.so.6 => /lib/libc.so.6 (0x40250000)
    libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4038d000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

    Thanks again,
    mike bautista



    "Dave Uhring" <daveuhring> wrote in message
    news:pan.2003.07.11.16.51.14.681959...
    > On Fri, 11 Jul 2003 09:24:00 -0700, Mike Bautista wrote:
    >
    > > How can I get linux to look at the LD_LIBRARY_PATH variable first, and
    > > if I do this, will it completely break Linux? Better yet, Can I set a
    > > flag that will make it read the LD_LIBRARY_PATH variable before all
    > > others for a particular session?
    >
    > man ld.so
    >
    > LD_PRELOAD
    > A whitespace-separated list of additional, user-
    > specified, ELF shared libraries to be loaded before
    > all others. This can be used to selectively over-
    > ride functions in other shared libraries. For
    > setuid/setgid ELF binaries, only libraries in the
    > standard search directories that are also setuid
    > will be loaded.
    >

    mike bautista Guest

  4. #4

    Default Re: LD_LIBRARY_PATH Behavior

    On Fri, 11 Jul 2003 10:51:34 -0700, mike bautista wrote:
    > Thanks for your quick reply Dave. However, I get this now. Perhaps I am
    > setting the variable incorrectly. seems like it is trying to force it, but
    > when it matter, it still access my sandbox.
    $ export LD_PRELOAD="/path_to/lib1.so /path_to/lib2.so"

    Dave Uhring Guest

  5. #5

    Default Re: LD_LIBRARY_PATH Behavior

    On Fri, 11 Jul 2003 13:44:18 -0700, mike bautista wrote:
    > Thanks again Dave,
    >
    > It appears that I am setting it right. This time I set the LD_DEBUG to all
    > and this is the line of interest (where it all goes terribly wrong). As
    > you can see, all it looks at is the RPATH and not anything else.
    >
    > my LD_PRELOAD is set up like this:
    >
    > setenv LD_PRELOAD "/projMan/RunEverything1.0/TCL-TK/linux/lib/libtk8.4.so"
    You asked the question in a Linux NG and the default shell in Linux is
    bash, not csh or tcsh. What is the output of

    $ env | grep SHELL

    Is the system on which you are trying to run this executable Linux? If
    so, have you included the necessary paths in /etc/ld.so.conf and executed
    'ldconfig'?

    Dave Uhring Guest

  6. #6

    Default Re: LD_LIBRARY_PATH Behavior

    Dave Uhring <daveuhring> wrote:
    > On Fri, 11 Jul 2003 13:44:18 -0700, mike bautista wrote:
    >> It appears that I am setting it right. This time I set the LD_DEBUG to all
    >> and this is the line of interest (where it all goes terribly wrong). As
    >> you can see, all it looks at is the RPATH and not anything else.
    >>
    >> my LD_PRELOAD is set up like this:
    >>
    >> setenv LD_PRELOAD "/projMan/RunEverything1.0/TCL-TK/linux/lib/libtk8.4.so"
    This is fine. That will be preloaded.
    > You asked the question in a Linux NG and the default shell in Linux is
    > bash, not csh or tcsh. What is the output of
    My own shell is tcsh.There is no general "default", well, it would be
    /bin/sh, I guess, in a number of senses, but there's nothing wrong in
    showing a csh setenv instead of a sh export.

    > $ env | grep SHELL
    >
    > Is the system on which you are trying to run this executable Linux? If
    > so, have you included the necessary paths in /etc/ld.so.conf and executed
    > 'ldconfig'?
    It doesn't matter. LD_LIBRARY_PATH is always observed. If you want to
    know the interaction between it and rpath ... ld(1):

    The linker uses the following search paths to locate
    required shared libraries.

    1. Any directories specified by -rpath-link options.

    2. Any directories specified by -rpath options. The
    difference between -rpath and -rpath-link is that
    directories specified by -rpath options are
    included in the executable and used at runtime,
    whereas the -rpath-link option is only effective
    at link time. It is for the native linker only.

    3. On an ELF system, if the -rpath and "rpath-link"
    options were not used, search the contents of the
    environment variable "LD_RUN_PATH". It is for the
    native linker only.

    4. On SunOS, if the -rpath option was not used,
    search any directories specified using -L options.

    5. For a native linker, the contents of the environ
    ment variable "LD_LIBRARY_PATH".

    6. For a native ELF linker, the directories in
    "DT_RUNPATH" or "DT_RPATH" of a shared library are
    searched for shared libraries needed by it. The
    "DT_RPATH" entries are ignored if "DT_RUNPATH"
    entries exist.

    7. The default directories, normally /lib and
    /usr/lib.

    so rpath comes before LD_LIBRARY_PATH.


    Peter
    Peter T. Breuer Guest

  7. #7

    Default Re: LD_LIBRARY_PATH Behavior

    On Fri, 11 Jul 2003 23:35:13 +0200, Peter T. Breuer wrote:
    >>> setenv LD_PRELOAD "/projMan/RunEverything1.0/TCL-TK/linux/lib/libtk8.4.so"
    >
    > This is fine. That will be preloaded.
    Only if the user's $SHELL is csh or tcsh.
    >> You asked the question in a Linux NG and the default shell in Linux is
    >> bash, not csh or tcsh. What is the output of
    >
    > My own shell is tcsh.There is no general "default", well, it would be
    > /bin/sh, I guess, in a number of senses, but there's nothing wrong in
    > showing a csh setenv instead of a sh export.
    Doesn't matter what -your- shell is; what is the OP's shell? And some,
    most(?), distros of Linux have this amusing thing:

    [duhring]$ ls -l `which sh`
    lrwxrwxrwx 1 root root 4 Apr 10 15:08 /bin/sh -> bash
    [duhring]$ cat /etc/slackware-version
    Slackware 9.0.0

    >> Is the system on which you are trying to run this executable Linux? If
    >> so, have you included the necessary paths in /etc/ld.so.conf and executed
    >> 'ldconfig'?
    >
    > It doesn't matter. LD_LIBRARY_PATH is always observed. If you want to
    > know the interaction between it and rpath ... ld(1):
    It does matter if the executable is being run on Solaris. The OP -did-
    mention trying to run his app on a Sun machine - which, arguably does not
    mean Solaris is running on that machine - and that was the reason for the
    question.
    > so rpath comes before LD_LIBRARY_PATH.
    Something which Solaris ld and ld.so.1 do not even recognize. Yet
    LD_PRELOAD is recognized by the run-time linkers in both Linux and Solaris
    and will prioritize the library calls to the preloaded libraries.

    Dave Uhring Guest

Similar Threads

  1. use lib -- different behavior
    By Jens M. Felderhoff in forum PERL Modules
    Replies: 3
    Last Post: August 16th, 07:39 AM
  2. difference between SHLIB_PATH, LD_LIBRARY_PATH
    By chennakeshava_ramesh@yahoo.co.in in forum Linux / Unix Administration
    Replies: 2
    Last Post: May 14th, 12:19 AM
  3. very odd behavior of X11 GUI
    By Cristi BODNARIUC in forum Sun Solaris
    Replies: 0
    Last Post: July 18th, 07:54 AM
  4. Replies: 2
    Last Post: July 10th, 12:44 AM
  5. Looking for a behavior
    By Kirk Zelinske in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 9th, 07:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139