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.

  • I guess gcc is calling another programs and not passing the -I parameters to them... – golimar Sep 19 '13 at 8:10
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

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.

  • 2
    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
  • 2
    @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 - Reinstate Monica Jun 25 '14 at 15:37
  • Cygwins gcc-g++ package had to be installed in my case (along with gcc-core and make) – Kjetil S. Nov 14 '17 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.