[rt.cpan.org #116056] Fixes for Cygwin build of PAR::Packer

[email protected] ("Ken Brown via RT")
Newsgroups perl.par
Message-ID <[email protected]>
Mon Jul 11 15:15:22 2016: Request 116056 was acted upon.
Transaction: Ticket created by [email protected]
       Queue: PAR
     Subject: Fixes for Cygwin build of PAR::Packer
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=116056 >


There are two problems with the build of PAR::Packer 1.033 on Cygwin:

1. The build fails with "undefined reference to `__stack_chk_fail'". 
This happens starting with version 1.030 due to the removal of the line

   $boot_ldflags .= $static_ldflags;

from Makefile.PL.  Adding that line back (see the attached 
boot_ldflags.patch) fixes the problem.

2. The method for detecting a 64-bit system in Makefile.PL, based on 
$Config{archname}, doesn't work on 64-bit Cygwin.  Here we have the 
following:

$ perl -e 'use Config; print $Config{archname}'
cygwin-thread-multi

$ perl -e 'use Config; print $Config{myuname}'
cygwin_nt-6.3 cygwin 2.5.1(0.29753) 2016-04-21 22:14 x86_64 cygwin

So PAR::Packer should use myuname on Cygwin instead of archname.  See 
the attached x86_64_cygwin.patch.  (This comes from a patch used by 
Yaakov Selkowitz, the Cygwin maintainer of PAR::Packer.)

Ken
boot_ldflags.patch (text/x-diff, 403 B)
--- origsrc/PAR-Packer-1.033/myldr/Makefile.PL	2016-05-12 03:20:37.000000000 -0400
+++ src/PAR-Packer-1.033/myldr/Makefile.PL	2016-07-11 14:08:53.133669400 -0400
@@ -173,6 +173,7 @@ if ($dynperl) {
     $perllibshortname =~ s/\Q.$so\E$//;
 }
 $static_ldflags =~ s/(^|\s)-l$perllibshortname(\s|$)/ /g;
+$boot_ldflags .= $static_ldflags;
 
 
 # In the $dynperl case, we've already found the $libperl DSO.
x86_64_cygwin.patch (text/x-diff, 704 B)
--- origsrc/PAR-Packer-1.033/myldr/Makefile.PL	2016-05-12 03:20:37.000000000 -0400
+++ src/PAR-Packer-1.033/myldr/Makefile.PL	2016-07-11 14:59:54.598986100 -0400
@@ -110,7 +110,8 @@ $res:
     $lddebug = ($debug or $^O eq 'darwin') ? '' : '-s ';
     $warn = $debug ? '-Wall -Wno-comments ' : '';
     if ( $^O =~ /^(?:MSWin|cygwin)/ ) {
-        my $target = $Config{archname} =~ /x64/ ? 'pe-x86-64' : 'pe-i386';
+        my $target = $Config{archname} =~ /x64/ || $Config{myuname} =~ /x86_64/
+	  ? 'pe-x86-64' : 'pe-i386';
         $res = 'ppresource.coff';
         # Note: On cygwin the command below will be processed by the
         # cygwin shell, so backslashes in pathnames might be a problem.
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.