8

I'm trying to install a module (Package::Stash::XS) via cpanm, but the installation is failing due to a gcc error. The command:

gcc -c    -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -fstack-protector -DUSEIMPORTLIB -O3    -DVERSION=\"0.28\"  -DXS_VERSION=\"0.28\"  "-I/usr/lib/perl5/5.14/x86_64-cygwin-threads/CORE"   XS.c

fails with the error:

XS.xs:1:20: fatal error: EXTERN.h: No such file or directory
compilation terminated.

at the line:

#line 1 "XS.xs"
#include "EXTERN.h"

However, the file EXTERN.h does exist in the -I included /usr/lib/perl5/5.14/x86_64-cygwin-threads/CORE:

$ ls /usr/lib/perl5/5.14/x86_64-cygwin-threads/CORE/E*
/usr/lib/perl5/5.14/x86_64-cygwin-threads/CORE/EXTERN.h

What could the issue be, and how can I make the compilation succeed? I've tried changing the -I to -iquote (though gcc manual does say double quoted includes also eventually use -I), but that doesn't help. My first thought was it was a permission issue, but this is Cygwin and cpanm is running as me and I do have read access to EXTERN.h and exec access on the CORE directory.

Worthwelle
  • 4,816
Sundar R
  • 1,539

2 Answers2

13

This was fixed by installing libcrypt-devel.

Then everything worked just fine... So problem solved!

This explains it better: Re: Difficult compiling Package::Stash::XS

Kevin Panko
  • 7,466
TuAmigo
  • 131
  • 1
  • 2
8

Ok, I believe I've found the issue. I'm running this in Cygwin as mentioned, and it appears Cygwin was trying to use Windows strawberry Perl's gcc since it's own gcc wasn't installed! The Windows gcc probably had problems with a Cygwin style path, hence the weird error. I've now installed Cygwin's gcc and this problem is gone. It complained next about a <crypt.h>, that too was solved by installing libcrypt-devel from the Cygwin setup dialog.

cxw
  • 1,739
Sundar R
  • 1,539