Dear all;

I've been playing around a bit with prefixifying ebuilds for software
that is only distributed in binary form.  An example of what I mean is
dev-lang/icc, but there are many others.  I'm not done playing, but
since dev-lang/icc and friends were prefix-keyworded recently, I'd like
to bring it up, nevertheless.

Static binaries are OK, but problems crop up during dynamic linking:
whether there is an rpath in the binary, or the runtime linker of the
host uses the paths from its configuration files, we'll probably end up
linking against libraries outside the prefix.  For an x86 prefix on an
x86 host things may still appear to work, but you'll notice as soon as
you run the x86 programs on an amd64 host.

As far as I can see, setting the rpath is one way to solve the problem,
and I've been toying around with patchelf to accomplish that (chrpath
won't work, because it doesn't allow rpaths to grow).  To my mind, the
process is conceptually similar to the "shebang prefixing" that happens
for shell scripts, so I'm wondering whether it would make sense to
implement it in a similar fashion, e.g.

  for each ELF file {
    prepend ${EPREFIX} to each rpath element
    prepend ${EPREFIX}/lib:${EPREFIX}/usr/lib to rpath
  }

somewhere in portage.  At least this allowed me to use icc to compile a
32 bit helloworld using an x86-prefix on both x86 and amd64.

// Cheers; Johan

Reply via email to