LD_LIBRARY_PATH - Linux

This is a discussion on LD_LIBRARY_PATH - Linux ; Hi , I have been looking at http://linuxmafia.com/faq/Admin/ld-lib-path.html & the Linux man pages. I am just trying to work out if LD_LIBRARY_PATH is used at link time or not. I have been told that it is only used at run ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: LD_LIBRARY_PATH

  1. LD_LIBRARY_PATH

    Hi ,

    I have been looking at http://linuxmafia.com/faq/Admin/ld-lib-path.html
    & the Linux man pages. I am just trying to work out if
    LD_LIBRARY_PATH is used at link time or not. I have been told that it
    is only used at run time, however if I set it and try to link some of
    the link errors seem to resolve themselves. Can some one please
    clarify whether or not LD_LIBRARY_PATH is used at both at link and run
    time.

    Thx


  2. Re: LD_LIBRARY_PATH

    0infinity0@gmail.com writes:
    > I have been looking at http://linuxmafia.com/faq/Admin/ld-lib-path.html
    > & the Linux man pages. I am just trying to work out if
    > LD_LIBRARY_PATH is used at link time or not. I have been told that it
    > is only used at run time,


    This is a question which could be answered really easily by having a
    look at the documenation instead of relying on 'stories told be other
    people' (who probably didn't check the documentation, too).

    For this particular case:

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

    [...]

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

    [ld(1)]

    The Gnu linker is usually the native linker on a Linux-based system,
    consequently, it will use this environment variable.

  3. Re: LD_LIBRARY_PATH

    On Oct 30, 5:53 am, 0infini...@gmail.com wrote:
    > Hi ,
    >
    > I have been looking athttp://linuxmafia.com/faq/Admin/ld-lib-path.html
    > & the Linux man pages. I am just trying to work out if
    > LD_LIBRARY_PATH is used at link time or not. I have been told that it
    > is only used at run time, however if I set it and try to link some of
    > the link errors seem to resolve themselves. Can some one please
    > clarify whether or not LD_LIBRARY_PATH is used at both at link and run
    > time.
    >
    > Thx


    Hi....
    LD_LIBRARY_PATH is used only at run time. The working is as follows,
    whenever you set the environment variable LD_LIBRARY_PATH at the time
    of execution, this library gets loaded before the executable and its
    constructor is executed prior to the control going to the program
    start address.

    AFAIK, it might be resolving some of your link errors but ya, this is
    not the proper use of it.

    Thanks & Regards,
    Sandeep.


  4. Re: LD_LIBRARY_PATH

    sandy writes:
    > On Oct 30, 5:53 am, 0infini...@gmail.com wrote:
    >> Hi ,
    >>
    >> I have been looking athttp://linuxmafia.com/faq/Admin/ld-lib-path.html
    >> & the Linux man pages. I am just trying to work out if
    >> LD_LIBRARY_PATH is used at link time or not. I have been told that it
    >> is only used at run time, however if I set it and try to link some of
    >> the link errors seem to resolve themselves. Can some one please
    >> clarify whether or not LD_LIBRARY_PATH is used at both at link and run
    >> time.
    >>
    >> Thx

    >
    > Hi....
    > LD_LIBRARY_PATH is used only at run time.


    This is wrong. RTFM ld.

  5. Re: LD_LIBRARY_PATH

    0infinity0@gmail.com wrote:
    > Hi ,
    >
    > I have been looking at http://linuxmafia.com/faq/Admin/ld-lib-path.html
    > & the Linux man pages. I am just trying to work out if
    > LD_LIBRARY_PATH is used at link time or not. I have been told that it
    > is only used at run time, however if I set it and try to link some of
    > the link errors seem to resolve themselves. Can some one please
    > clarify whether or not LD_LIBRARY_PATH is used at both at link and run
    > time.


    LD_LIBRARY_PATH is used at runtime to specify non-standard paths for
    dynamic shared libraries.
    During link time, you can just give the full library path.

    --
    These are my personal views and not those of Fujitsu Siemens Computers!
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize (T. Pratchett)
    Company Details: http://www.fujitsu-siemens.com/imprint.html


  6. Re: LD_LIBRARY_PATH

    sandy wrote:
    > On Oct 30, 5:53 am, 0infini...@gmail.com wrote:
    >
    >>Hi ,
    >>
    >> I have been looking athttp://linuxmafia.com/faq/Admin/ld-lib-path.html
    >>& the Linux man pages. I am just trying to work out if
    >>LD_LIBRARY_PATH is used at link time or not. I have been told that it
    >>is only used at run time, however if I set it and try to link some of
    >>the link errors seem to resolve themselves. Can some one please
    >>clarify whether or not LD_LIBRARY_PATH is used at both at link and run
    >>time.
    >>
    >>Thx

    >
    >
    > Hi....
    > LD_LIBRARY_PATH is used only at run time. The working is as follows,
    > whenever you set the environment variable LD_LIBRARY_PATH at the time
    > of execution, this library gets loaded before the executable


    ITYM LD_PRELOAD.

    > and its
    > constructor is executed prior to the control going to the program
    > start address.


    "constructor" is an OO term.
    With "ordinary" C-programs this would be the "_init"-function of the
    shared library.

    --
    These are my personal views and not those of Fujitsu Siemens Computers!
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize (T. Pratchett)
    Company Details: http://www.fujitsu-siemens.com/imprint.html


  7. Re: LD_LIBRARY_PATH

    Rainer Weikusat writes:

    > sandy writes:
    >> On Oct 30, 5:53 am, 0infini...@gmail.com wrote:
    >>> Hi ,
    >>>
    >>> I have been looking athttp://linuxmafia.com/faq/Admin/ld-lib-path.html
    >>> & the Linux man pages. I am just trying to work out if
    >>> LD_LIBRARY_PATH is used at link time or not. I have been told that it
    >>> is only used at run time, however if I set it and try to link some of
    >>> the link errors seem to resolve themselves. Can some one please
    >>> clarify whether or not LD_LIBRARY_PATH is used at both at link and run
    >>> time.
    >>>
    >>> Thx

    >>
    >> Hi....
    >> LD_LIBRARY_PATH is used only at run time.

    >
    > This is wrong. RTFM ld.


    It used to be true, and is the norm on non-GNU systems.

    --
    Måns Rullgård
    mans@mansr.com

+ Reply to Thread