in reply to Relocatable Perl 5.10.0 on Solaris

I'm confused. Either you mean something with "relocatable" that's different from what I mean, or I'm not understanding your configuration.

Your Linux configuration uses absolute directories for its @INC. This means that you can launch perl from any directory and it will find its libraries. But this also means that you cannot move perl or its directories to any other place. So, in my opinion, the Linux perl is not relocatable.

Your Solaris configuration uses relative directories for its @INC. This means that you can only launch perl from a directory where ../lib points to the Perl libraries. This also means that you can move perl around wherever you want to, as long as you invoke it from a directory in the right relative position. In this case, the Solaris perl is somewhat relocatable.

I think Unixish operating systems have a problem with determining the directory where an executable lives in and hence it's not really supported for a program to find out the directory it is living in to determine the place of library directories in relation to that path.

Replies are listed 'Best First'.
Re^2: Relocatable Perl 5.10.0 on Solaris
by almut (Canon) on May 16, 2008 at 09:59 UTC
    I think Unixish operating systems have a problem with determining the directory where an executable lives in and hence it's not really supported for a program to find out the directory it is living in to determine the place of library directories in relation to that path.

    ...but I think that's how it's meant to work, if I'm reading the docs correctly (from perl5100delta.pod):

    Relocatable installations

    There is now Configure support for creating a relocatable perl tree. If you Configure with -Duserelocatableinc, then the paths in @INC (and everything else in %Config) can be optionally located via the path of the perl executable.

    That means that, if the string ".../" is found at the start of any path, it's substituted with the directory of $^X. So, the relocation can be configured on a per-directory basis, although the default with -Duserelocatableinc is that everything is relocated. The initial install is done to the original configured prefix.

    So, I'd say the OP's expectations are at least somewhat legitimate :)

      Ah hah - so maybe the issue is that the Solaris @INC does not contain .../ but ./../, at least to what the OP showed us. So either the Perl was configured wrong or the configure process went wrong somewhere. Maybe patching the resulting binary is the easiest way out, as the string only decreases in length which can easily be fixed by zero padding it at the end.

        Alas, no - I checked using a hex editor, and both binaries definitely contain .../../lib. So the problem appears to be a runtime one, not at configure/build.

        This is why I was hoping it was a library problem :(.

        Regards,
        CK.
Re^2: Relocatable Perl 5.10.0 on Solaris
by Anonymous Monk on May 16, 2008 at 09:46 UTC
    Nicholas Clark applied for a grant to fix this, i don't know if he has :)
Re^2: Relocatable Perl 5.10.0 on Solaris
by Anonymous Monk on May 16, 2008 at 09:50 UTC
    Thanks for your quick response...

    To clarify - they are BOTH built with -Duserelocatableinc, which (according to the perl 5.10.0 docs) should make them relocatable. @INC paths reported by the -V flag are as you say fixed and relative respectively, however they are resolved to this at run time. Within the binary they are stored as .../../lib etc... So what seems to be happening is that the Linux binary resolves ... to the binary path (in this case /home/user/bin) and the Solaris binary resolves ... to the current path (.).

    The Linux binary definitely is relocatable. If I rename the install dir it still works (provided it's found in the PATH of course).

    Regards,
    CK.