Need help with relocatable perl compilation

Karl Williamson via perl5-porters <[email protected]>
Newsgroups gmane.comp.lang.perl.perl5.porters
Message-ID <[email protected]>
I'm forwarding to this list the relevant parts of an email I received 
from IBM concerning a problem with perl on z/OS.  This is totally 
outside my area of expertise.

They first notified me about a 'use diagnostics' failing to find the 
module.  I looked at their recent patch and found a typo.  But it turns 
out that was not the root cause of the problem.

They have a patch that fixes their problem, described in their 
correspondence.  My questions basically come down to, are they missing 
something we already have (likely undocumented) that would make this 
easier to solve than their approach.  It sounds like something that 
should have come up long before in other situations.


-------- Forwarded Message --------
Subject: 	Re: two removed patch files still are in perl patches directory
Date: 	Wed, 5 Aug 2026 12:57:16 +0000
From: 	Haritha D <[email protected]>
To: 	Karl Williamson <[email protected]>

I'm following up on the discussion regarding the |use diagnostics| issue 
on z/OS. During our investigation, we found that the problem was caused 
by two underlying issues related to relocatable installations 
(|-Duserelocatableinc|).

We've resolved both the diagnostics issue and its root causes, and I 
wanted to share the details

  1.


           |relocate_inc()| Fails to Resolve Paths After Relocation Issue

After Perl is moved to a different directory following installation, the 
|relocate_inc()| function in |Config.pm| fails to:

   *

     Properly resolve the executable path when |$^X| is not an absolute 
path.

   *

     Handle the relocatable placeholder form (|../../../|) correctly.

   *

     Strip the |/bin| suffix when computing library paths.

As a result, Perl is unable to locate its libraries (including 
|pod/perldiag.pod|) after relocation,and causing |use diagnostics| to fail.

*Our Fix (*|*configpm*|* patch)*

We updated |relocate_inc()| to:

   *

     Skip paths that are already in the correct form (|lib/5.44.0/...|).

   *

     Distinguish between the two relocation formats:

       o

         |../../../| (relocatable placeholder requiring |/bin| suffix
         removal)

       o

         |../../| (standard relative form)

   *

     Resolve the executable correctly when |$^X| is a bare command by
     searching |$PATH|.

   *

     Remove the |/bin| suffix when using the relocatable placeholder form.

These changes allow Perl to compute the correct library paths regardless 
of where the installation is relocated.


       2. |installperl| Creates Duplicate Version Directories Issue

The |installperl| script was creating nested version directories such 
as: |lib/5.44.0/5.44.0/os390/|

This resulted in:

   *

     Duplicate file installations.

   *

     Incorrect library search paths.

*Our Fix (*|*installperl*|* patch)*

We addressed this by:

   *

     Pruning version directories early during installation.

   *

     Normalizing destination paths to eliminate duplicate version 
components.

This ensures libraries are installed only once in the expected location: 
|$prefix/lib/5.44.0/os390/|

instead of: |$prefix/lib/5.44.0/5.44.0/os390/|


       Impact

These fixes are particularly important because:

   *

     The zopen build system relies on relocatable installations.

   *

     Perl packages are expected to be distributed and installed in
     different locations.

   *

     Path handling differs from traditional Unix environments.

Both patches have been working well in our testing environments, and the 
|use diagnostics| issue is now fully *resolved*.

The pull request containing the complete details and patches is 
available here:

https://github.com/zopencommunity/perlport/pull/140 
<https://github.com/zopencommunity/perlport/pull/140>

I'd be happy to discuss the implementation further or explore 
alternative approaches based on your feedback.

Please let me know if you need any additional information or clarification.

Best regards,

Haritha
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.