Re: Absolute paths



Mathieu Lacage wrote:
> Drazen Kacar <dave@srce.hr> writes:

> > The proper way to link binaries is to use -R flag. One usually puts
> > an absolute path here, but then the libraries won't be relocatable.
> > On Solaris you can use `-R $ORIGIN/../lib'. That way you can have
> > binaries in $prefix/bin and libraries in $prefix/lib. As long as you
> > keep them under the same $prefix, the apps will be able to find the
> > libraries.
> 
> Is this supported by the current autoconf/automake/libtool tools ? 
> Or do you need to add these by hand ?

It can't work for several reasons. The first is that autoconf and libtool
are sh scripts and whatever was passed in LDFLAGS is not properly quoted,
so $ORIGIN expands to an empty string, instead of being passed literaly.

If that gets fixed, then we have a problem with automake, because $ has
a special meaning in Makefiles and automake doesn't quote properly.

If that gets fixed, then we have autoconf design problem. For simplicity,
suppose that everything goes to /usr/local. The libraries should be
linked with -R$ORIGIN (so they can find other libraries), but the
applications should be linked with -R$ORIGIN/../lib. You can't achieve
this with only one environment variable, ie. LDFLAGS.

If that gets fixed, we have a libtool problem because it refuses to
pass -R flag when linking libraries.

If that gets fixed, we have a problem with *-config scripts (and possible
replacements). On systems with large number of users (thousands or tens
of thousands), it's perfectly normal that admins install (what they
consider to be) stable stuff in system directories and that unstable
apps don't get installed there, because admins are just not able to
support thousands of users who all have a problem at the same time
(like buggy app deleting something). But if the users want to take
their chances with unstable apps, they are free to do so. So, when
an admin compiles something, he should link it with $ORIGIN, but when
users compile something they shouldn't. If I installed GTK in /usr/local/lib
then apps in /usr/local/bin can be linked with -R$ORIGIN/../lib, but
apps that live in $HOME/bin should be linked with -R/usr/local/lib.
*-config scripts are not capable of making the difference.

I could probably find more problems, but I think this is quite enough.
About a year ago I thought it would be cool to have location independent
GNOME, so I found a way to do it with my libc and ld(1), but the
current state of build tools makes it impossible to implement.

-- 
 .-.   .-.    I don't work for my employer.
(_  \ /  _)
     |        dave@srce.hr
     |        dave@fly.srk.fer.hr





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]