Tue Jan 14 10:43:07 2014: Request 92144 was acted upon.
Transaction: Ticket created by PLICEASE
       Queue: Inline
     Subject: can't find gcc-4 on cygwin (patch to fix)
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: plice...@cpan.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=92144 >


Hi there, the Makefile.PL incorrectly is unable to find gcc-4 on cygwin:

 Config.pm indicates that your version of Perl was built with this C compiler:
 
     gcc-4
 
 I cannot locate this compiler on your system.

This  patch fixes it:

--- a/C/Makefile.PL
+++ b/C/Makefile.PL
@@ -5,6 +5,7 @@ use File::Spec;
 
 my ($cc, $exe) = @Config{'cc', '_exe'};
 $cc =~ s/\s+-.+$//; #remove possible trailing options
+$exe = '' if $^O eq 'cygwin';
 
 my $found = 0;
 my $delim = $Config::Config{path_sep};

explanation: Although executable by convention end in .exe on Cygwin, programs 
in the PATH, may actually be a symlink without an extension, as is the case 
with gcc-4:

 fs01% ls -l /usr/bin/gcc-4*
 lrwxrwxrwx 1 ollisg None 7 Sep 13 10:42 /usr/bin/gcc-4 -> gcc.exe*

The patch above still also works if $Config{cc} is not a symlink and does have 
the .exe extension, because on Cygwin -f (and friends) works both with and 
without the extension for executable.  For example:

 fs01% ls -l /usr/bin/df*
 -rwx------+ 1 ollisg None 90638 Feb  6  2012 /usr/bin/df.exe*
 fs01% perl -E 'say -f "/usr/bin/df"'
 1
 fs01% perl -E 'say -f "/usr/bin/df.exe"'
 1

Reply via email to