Use configure.ldflags-delete instead of configure.ldflags?

Anders F Björklund afb at macports.org
Fri Mar 18 08:15:22 PDT 2011


Rainer Müller wrote:

> On 03/18/2011 09:58 AM, Ryan Schmidt wrote:
>> Can you give an example of a library that would not be relocatable?
> 
> As Anders already said, anything that uses data files from
> ${prefix}/share or ${prefix}/etc and has these paths hardcoded for this
> purpose.

And that's on a *good* day. Usually it's "/usr/share" and "/etc".
(looking at you, glib. Thanks for that $XDG_DATA_DIRS requirement)

Some of the more subtle points are the ones that get clever and
presume that everything is installed to the *same* directory...
So they would use the prefix of "foo", to get the prefix of "bar".
Which of course works just fine if both are /usr, but not always.

MacPorts usually relocates everything to the same directory anyway
(i.e. by linking to the "software" images, rather than referring)
But other software that uses one prefix per program has problems.
Or one prefix per program-version, even (to allow multiple installs)

I think most of the hardcoded "/opt/local" strings have been fixed.
Making ${prefix} a run-time thing, that is definitely still TODO...


There was an over-engineered solution called "binreloc" for this,
that was for Linux but also portable to Solaris/Darwin (not BSD ?).

http://www.autopackage.org/docs/binreloc/
-> _NSGetExecutablePath(path, &path_len);

--anders



More information about the macports-dev mailing list