Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

perlxstut (compiler problems)

by llee (Initiate)
on Jul 13, 2006 at 22:56 UTC ( [id://561099]=perlquestion: print w/replies, xml ) Need Help??

llee has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use nmake to complete the perlxstut tutorial. The tutorial tells you to use a batch program named h2xs.bat to create a directory named mytest and populate it with a group of files. It then tells you to run Makefile.pl which prepares a file for use by nmake.exe.

When I run nmake on the folder I get the following error:

  • "C:\Perl\lib\CORE|perl.h(441): fatal error C1083: Cannot open include file: 'sys/types.h : No such file or directory
  • NMAKE : fatal error U1077: 'C:\Windows\system32\cmd.exe' : return code '0x2' Stop"

  • On my machine nmake.exe calls cl.exe with the following parameters:


  • "cl -c -nologo -01 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX -01 -MD -Zi _DNDEBUG -DVERSION=\"0.01\" -DNS_VERSION=\"0.01\" -IC:\Perl\lib\CORE mytest.c"

  • I was originally missing the following files and programs:


  • msvc and importantly cl.exe (this was installed in C:\program files\microsoft platform sdk\bin\win64)
  • nmake.exe (this was installed in c:\perl\bin)
  • PerlCRT.dll (installed in system32 folder)
  • (and) PerlCRT.lib (copied to Perl's Core directory)

  • Chances are my system will need to be configured further, but I'm hoping there's not much left.
    I installed perl using 'ActivePerl-5.6.1.638-MSWin32 Windows Installer Package', which I downloaded a while ago from CPAN.
    I'm stuck, and the features offered by .xs files seem promising. Any help would be appreciated. Thanks.

    Replies are listed 'Best First'.
    Re: perlxstut (compiler problems)
    by syphilis (Archbishop) on Jul 14, 2006 at 02:02 UTC
      I think you just need to execute vcvars32.bat, which is usually located in the same folder that houses 'cl.exe'. That sets up some environment variables that enables 'sys/types.h' (and other needed files) to be found.

      I also think you don't want to be accessing PerlCRT.dll and PerlCRT.lib (which would best be removed from perl's core folder).

      Fwiw, I found that using Inline::C (which autogenerates the XS file for you) was the best introduction to writing perl extensions.

      Cheers,
      Rob
        I couldn't find vcvars32.bat on my system. I don't think that it's installed.
          Are you using the free download from Microsoft ? I've not used it ... I assume that it comes with a vcvars32.bat (as is the case with VC7.0 and earlier) that you run to set up the necessary environment variables. But, of course, assumptions are especially susceptible to error :-)

          Basically you need to set the "INCLUDE" environment variable to include the locations of the header files ... but then there are other environment variables to set up, too. If you can't dig up the information as to how that is normally done, then I guess you'll need the advice of someone who has actually used that particular compiler.

          Cheers,
          Rob
    Re: perlxstut (compiler problems)
    by Steve_p (Priest) on Jul 14, 2006 at 03:02 UTC

      Looking at this I think I see your problem. Usually, in one of the Start menu submenus off of your compiler install, is the compiler tools command line shell. You should work in that shell so that paths, environment variables, etc. are set up correctly for you to compile Perl extensions.

    Re: perlxstut (compiler problems)
    by jdtoronto (Prior) on Jul 13, 2006 at 23:56 UTC
      My first question is what C compiler are you using? My understanding is htat this will only work if you use the same compiler that was used for Perl, in this case Visual C++ 6.0.

      jdtoronto

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Node Status?
    node history
    Node Type: perlquestion [id://561099]
    Approved by GrandFather
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others taking refuge in the Monastery: (3)
    As of 2025-07-17 00:22 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.