Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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*

What could the issue be, and how can I make the compilation successful? 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.

share|improve this question
I guess gcc is calling another programs and not passing the -I parameters to them... – golimar Sep 19 '13 at 8:10

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

share|improve this answer
up vote 3 down vote accepted

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 a few crypt-related libraries from the Cygwin setup dialog.

share|improve this answer
Note that it is not useful as a user to read "installing a few crypt-related libraries". It is useful to read "installing libcrypt-devel" – Rob Hall Jun 24 '14 at 14:33
@RobHall Thanks for mentioning the library. I must have written it that way because I just went out and installed whatever had "crypt" in the name, and didn't know specifically which one helped. – sundar Jun 25 '14 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .