1

I used to use MinGW for compiling cpan modules. Now on my new computer i installed VisualStudio and CPAN now tries to to use the vs-compiler and fails because it can't find "sys/types.h".

How do I tell cpan to use MinGW? I couldn't find a commoand-line option for this. Can i fix the problem otherise using vs-compiler? Where would I put sys/types.h? How do I pass the include command from cpan to the compiler?

1 Answer 1

3

If you're trying to compile CPAN modules with a different C compiler than your Perl was built with, you're asking for trouble. The typical Perl module with XS code uses the compiler flags from your Perl config (see perl -V). Since ActivePerl is built with MSVC, $Config{ccflags} contains MSVC-specific flags which won't work with MinGW's gcc.

So if you use ActivePerl, you should stick with MSVC. If you want to use MinGW, switch to Strawberry Perl.

That said, sys/types.h is a POSIX header. If your module needs it, it probably doesn't support Windows regardless of the compiler you use. In that case, you can only switch to Cygwin which emulates a POSIX environment.

MSVC should come with sys/types.h. You probably didn't set it up correctly. Did you run vcvars.bat?

If you tell us which module you're trying to install, you might get a better answer.

3
  • the module i wanted is Moose. However i could install it using precompiled binaries using ppm. But Moose should definetly be supported on windows.
    – Luke
    Mar 8, 2014 at 15:48
  • That's strange. Moose doesn't include sys/types.h.
    – nwellnhof
    Mar 8, 2014 at 22:38
  • Did you set up MSVC by running vcvars.bat?
    – nwellnhof
    Mar 8, 2014 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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