Unix Technical Forum

LD_LIBRARY_PATH - is there an easier way?

This is a discussion on LD_LIBRARY_PATH - is there an easier way? within the comp.unix.solaris forums, part of the Solaris Operating System category; --> barts@smaalders.net wrote: > Gnu ld already has added support for this > with the -z origin flag. > > ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > comp.unix.solaris

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #31 (permalink)  
Old 01-06-2008, 08:48 PM
Logan Shaw
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

barts@smaalders.net wrote:

> Gnu ld already has added support for this
> with the -z origin flag.
>
> http://www.die.net/doc/linux/man/man1/ld.1.html


Interesting. I went to www.gnu.org and looked at the documentation
for ld, and it doesn't describe "-z origin". For "-z", it just says,
"This option is ignored for Solaris compatibility." For some reason,
gnu.org has ld-2.9.1 listed, and nothing newer, and since gnu.org
should be up to date on GNU software, I might be tempted to assume
that's the latest version.

So, I went over to my Gentoo Linux system. Manual pages for all kinds
of other things exist and work fine, but if I type "man ld", I get
an error message that says "No such file or directory", even though
/usr/share/man/man1/ld.1.gz does exist.

Then I went to www.gentoo.org and clicked on "Documentation" and
went to the "User Docs" and then "Documentation Listing", and I
searched that for "manual page" and "man page" and "manpage", but
they don't seem to have manual pages online(?!) or haven't listed
them under the name manpage.

So I guess, unless I were really persistent, if I were building some
software for Linux, I might give up at this point and decide that
there is no $ORIGIN support.

> Now the trick is to ween people from doing it wrong - but
> that's harder


Indeed. First they need to understand that being sloppy and
hardcoding things is dumb and makes extra work for everybody.

- Logan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #32 (permalink)  
Old 01-06-2008, 08:48 PM
Dave Uhring
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

On Tue, 08 Mar 2005 17:57:37 +0000, Logan Shaw wrote:

> Interesting. I went to www.gnu.org and looked at the documentation
> for ld, and it doesn't describe "-z origin". For "-z", it just says,
> "This option is ignored for Solaris compatibility." For some reason,
> gnu.org has ld-2.9.1 listed, and nothing newer, and since gnu.org
> should be up to date on GNU software, I might be tempted to assume
> that's the latest version.


Slackware-10.0 has binutils-2.15.90.0.3 and the -z argument is described
in the ld(1) man page.

ftp://ftp.gnu.org/pub/gnu/binutils lists binutils-2.15.tar.bz2 as being
available as a "release". It appears to be some six years newer than your
version 2.9.1.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #33 (permalink)  
Old 01-06-2008, 08:48 PM
Drazen Kacar
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Logan Shaw wrote:

> So I guess, unless I were really persistent, if I were building some
> software for Linux, I might give up at this point and decide that
> there is no $ORIGIN support.


You were looking at all the wrong places. The right place is the dynamic
loader documentation. GNU ld might or might not support $ORIGIN. If it
does, $ORIGIN won't have any effect unless ld.so supports it as well.
(This is the situation on FreeBSD, for example.)

--
.-. .-. Yes, I am an agent of Satan, but my duties are largely
(_ \ / _) ceremonial.
|
| dave@fly.srk.fer.hr
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #34 (permalink)  
Old 01-06-2008, 08:48 PM
Logan Shaw
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Drazen Kacar wrote:
> Logan Shaw wrote:


>> So I guess, unless I were really persistent, if I were building some
>> software for Linux, I might give up at this point and decide that
>> there is no $ORIGIN support.


> You were looking at all the wrong places. The right place is the dynamic
> loader documentation. GNU ld might or might not support $ORIGIN. If it
> does, $ORIGIN won't have any effect unless ld.so supports it as well.


True, but if GNU ld is the linker on Linux and GNU ld does not support
it, then it will not work, because there is no way to build an
executable with the $ORIGIN data in there.

And anyway, the point I was making is just that it's a sad state of
affairs when it comes to usability. There is nothing unusual about
my Linux install, and I checked three obvious places to see if I
could find how to do $ORIGIN on Linux. Two of them gave no information
at all, and one of them gave woefully out of date information. So,
if I were Joe Average User and I did that, I'd never know that $ORIGIN
existed, unless I were careful to run "ld --version" and thus notice
that the gnu.org web site was providing out of date info.

The point is, it's no wonder that people don't use it on Linux if
you can't even find the documentation on *how* to use it.

- Logan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #35 (permalink)  
Old 01-06-2008, 08:48 PM
Casper H.S. Dik
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Drazen Kacar <dave@fly.srk.fer.hr> writes:

>Logan Shaw wrote:


>> So I guess, unless I were really persistent, if I were building some
>> software for Linux, I might give up at this point and decide that
>> there is no $ORIGIN support.


>You were looking at all the wrong places. The right place is the dynamic
>loader documentation. GNU ld might or might not support $ORIGIN. If it
>does, $ORIGIN won't have any effect unless ld.so supports it as well.
>(This is the situation on FreeBSD, for example.)


'$ORIGIN' is just a magic RPATH token which doesn't require "ld(1)"
support.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #36 (permalink)  
Old 01-06-2008, 08:48 PM
Dan Espen
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Logan Shaw <lshaw-usenet@austin.rr.com> writes:

> Drazen Kacar wrote:
>> Logan Shaw wrote:

>
>>> So I guess, unless I were really persistent, if I were building some
>>> software for Linux, I might give up at this point and decide that
>>> there is no $ORIGIN support.

>
>> You were looking at all the wrong places. The right place is the dynamic
>> loader documentation. GNU ld might or might not support $ORIGIN. If it
>> does, $ORIGIN won't have any effect unless ld.so supports it as well.

>
> True, but if GNU ld is the linker on Linux and GNU ld does not support
> it, then it will not work, because there is no way to build an
> executable with the $ORIGIN data in there.
>
> And anyway, the point I was making is just that it's a sad state of
> affairs when it comes to usability. There is nothing unusual about
> my Linux install, and I checked three obvious places to see if I
> could find how to do $ORIGIN on Linux. Two of them gave no information
> at all, and one of them gave woefully out of date information. So,
> if I were Joe Average User and I did that, I'd never know that $ORIGIN
> existed, unless I were careful to run "ld --version" and thus notice
> that the gnu.org web site was providing out of date info.
>
> The point is, it's no wonder that people don't use it on Linux if
> you can't even find the documentation on *how* to use it.


On my Linux system, 'man ld' works fine.
Perhaps you neglected to install the documentation.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #37 (permalink)  
Old 01-06-2008, 08:48 PM
Logan Shaw
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Dan Espen wrote:
> On my Linux system, 'man ld' works fine.
> Perhaps you neglected to install the documentation.


Nope, I installed the documentation, and for all "foo" (where
"foo" is anything *other* than ld), "man foo" works fine.
It's just "man ld" which doesn't work, and which gives an
incorrect (or at least very misleading) error message.

- Logan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #38 (permalink)  
Old 01-06-2008, 08:48 PM
Dan Espen
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Logan Shaw <lshaw-usenet@austin.rr.com> writes:

> Dan Espen wrote:
>> On my Linux system, 'man ld' works fine.
>> Perhaps you neglected to install the documentation.

>
> Nope, I installed the documentation, and for all "foo" (where
> "foo" is anything *other* than ld), "man foo" works fine.
> It's just "man ld" which doesn't work, and which gives an
> incorrect (or at least very misleading) error message.


Sorry to hear that.

Lets see, I'll check around.

Mandrake 10.1 - man ld works
Mandrake 8.1 - man ld works
RedHat Linux 3.2.2 - man ld works
RedHat Linux 3.2.3 - man ld works

Nope, can't find a broken man ld anywhere.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #39 (permalink)  
Old 01-06-2008, 08:48 PM
Tim
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Logan Shaw <lshaw-usenet@austin.rr.com> writes:

> Nope, I installed the documentation, and for all "foo" (where
> "foo" is anything *other* than ld), "man foo" works fine.
> It's just "man ld" which doesn't work, and which gives an
> incorrect (or at least very misleading) error message.


I've seen problems with Linux man pages vary with the locale you're
using. I use the Posix locale, and there are some man pages in RH9
that fail, though I don't recall the error offhand.

tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #40 (permalink)  
Old 01-06-2008, 08:48 PM
barts@smaalders.net
 
Posts: n/a
Default Re: LD_LIBRARY_PATH - is there an easier way?

Note of course that at least on Solaris you can set the environment
variable LD_CONFIG to point to a config file for your own processes; a
handy way of testing things.

If you set the system config file /var/ld/ld.config, make sure it works
during boot when other filesystems aren't mounted... :-)

- Bart

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com