Mon Mar 21 05:44:09 2011: Request 53463 was acted upon.
Transaction: Correspondence added by lgtaube
       Queue: PAR-Packer
     Subject: PAR::Packer 1.002 on HPUX 11.23 PA-RISC issue
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: chenshen...@gmail.com
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53463 >


On Thu Jan 07 03:45:56 2010, RSCHUPP wrote:
> Then maybe someone - not me :) - with a better understanding
> of how (old style, i.e. non-ELF) linking works on HPUX can spot
> why this happens.

While I make no claim about understanding how linking on HP-UX works,
I think I know the why the situation occurs (and how to make it work).

The problem (and its solution) is two-fold:

1. HP-UX has *two* environment variables for runtime linking, 
   LD_LIBRARY_PATH and SHLIB_PATH. Step one is to add SHLIB_PATH
   to the list of variables in myldr/mktempdir.c

2. HP-UX binaries are not (by default, AFAIK) configured to actually
   care if the environment variables in question have values, or not.
   Step two in the solution is to explicitly enable this functionality
   by calling "chatr +s enable <BINARY>" in myldr/static.c

I have tried and verified this on HP-UX 11.11 PA-RISC with
PA-Packer 1.008.


A patch is attached.

  --lgt



*** mktmpdir.c.OLD	Wed Mar 16 21:13:17 2011
--- mktmpdir.c	Wed Mar 16 21:13:37 2011
***************
*** 33,41 ****
  {
     const char *key = NULL , *val = NULL;
     int i;
!    const char *ld_path_keys[6] = {
        "LD_LIBRARY_PATH", "LIBPATH", "LIBRARY_PATH",
!       "PATH", "DYLD_LIBRARY_PATH", ""
     };
     char *ld_path_env = NULL;
      for ( i = 0 ; strlen(key = ld_path_keys[i]) > 0 ; i++ ) {
--- 33,41 ----
  {
     const char *key = NULL , *val = NULL;
     int i;
!    const char *ld_path_keys[7] = {
        "LD_LIBRARY_PATH", "LIBPATH", "LIBRARY_PATH",
!       "PATH", "DYLD_LIBRARY_PATH", "SHLIB_PATH", ""
     };
     char *ld_path_env = NULL;
      for ( i = 0 ; strlen(key = ld_path_keys[i]) > 0 ; i++ ) {
*** static.c.OLD	Wed Mar 16 22:53:47 2011
--- static.c	Thu Mar 17 09:17:51 2011
***************
*** 41,46 ****
--- 41,49 ----
      char *my_file;
      char *my_perl;
      char buf[20];	/* must be large enough to hold "PAR_ARGV_###" */
+ #ifdef __hpux
+     char chatrcmd[255];
+ #endif
  #ifdef WIN32
  typedef BOOL (WINAPI *pALLOW)(DWORD);
      HINSTANCE hinstLib;
***************
*** 69,74 ****
--- 72,82 ----
          WRITE_load_my_par(i);
          close(i); chmod(my_perl, 0755);
      }
+ 
+ #ifdef __hpux
+     (void)snprintf(chatrcmd, 40+strlen(my_perl), "/usr/bin/chatr +s enable %s > /dev/null",my_perl,0);
+     (void)system(chatrcmd);
+ #endif
  
      /* extract libperl DLL into stmpdir */
      i = my_mkfile( argv[0], stmpdir, name_load_my_libperl, size_load_my_libperl, &my_file );

Reply via email to