Search code examples
perlmodulemakefilecygwin

Installing Perl module on cygwin (make failed)


I need Digest::SHA1 for a Perl script that I'd like to run on cygwin. However, I have to configure it using CPAN. Everything seems fine until I run cpan[1]> install Digest::SHA1. Stuff goes on, then I'm given the following error:

/bin/sh: gcc-4: command not found
Makefile:327: recipe for target `SHA1.o' failed
make: * [SHA1.o] Error 127
GAAS/Digest-SHA1-2.13.tar.gz
/usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make Running make install
Make had returned bad status, install seems impossible
Failed during this command:
GAAS/Digest-SHA1-2.13.tar.gz : make NO

It seems like I must have gcc4 installed. The make error is not because of its path because it's set up correctly (o conf make in CPAN returns /usr/bin/make and I have make's binaries installed.). Unfortunately cygwin doesn't provide gcc4 package (it's marked as an obsolete package). Is there any workaround to fix this? Or is there a way I can compile gcc4 under cygwin, because simply chaning gcc-4 to gcc in the Makefile did not work.


Solution

  • Generally, you must use the same compiler for XS that was used to compile Perl. You can try to force the one you have and see what happens:

    cpan> look Digest::SHA1
    Digest-SHA1-2.13$ perl Makefile.PL CC=/usr/bin/gcc LD=/usr/bin/gcc
    Digest-SHA1-2.13$ make ; make test ; make install