I'm using ActiveState Perl and the MingW C compiler as supplied with Dev-cpp.

Admin://{C} # perl -v This is perl, v5.10.1 built for MSWin32-x86-multi-thread (with 2 registered patches, see perl -V for more detail) ... Admin://{C} # gcc -dumpversion 3.4.2

I'm trying to compile an XS module that compiles fine on another system that uses MS Visual Studio instead of MingW.

It seems like the 'nmake' is "printing" the gcc step, but not actually executing it as no '.o' file is created. If I run nmake, it bombs out, but if I then manually re-run the gcc step, the '.o' file is created and a subsequent 'nmake' works fine.

Admin://{C} # perl Makefile.PL Set up gcc environment - 3.4.2 (mingw-special) Checking if your kit is complete... Looks good Writing Makefile for Win32::LockWorkStation Admin://{C} # nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cp lib/Win32/LockWorkStation.pm blib\lib\Win32\LockWorkStation.pm C:\Perl\bin\perl.exe C:\Perl\site\lib\ExtUtils\xsubpp -typema +p C:\Perl\ lib\ExtUtils\typemap LockWorkStation.xs > LockWorkStation.xsc && C:\P +erl\bin\pe rl.exe -MExtUtils::Command -e "mv" -- LockWorkStation.xsc LockWorkStat +ion.c c:/Dev-Cpp/bin/gcc.exe -c -DNDEBUG -DWIN32 -D_CONSOLE -DNO_ +STRICT -DH AVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLIC +IT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE + -fno-stri ct-aliasing -mms-bitfields -O2 -DVERSION=\"0.01\" -DXS_VERSION=\"0 +.01\" "-I C:\Perl\lib\CORE" -D_WIN32_WINNT=0x0500 LockWorkStation.c Running Mkbootstrap for Win32::LockWorkStation () C:\Perl\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 Loc +kWorkStati on.bs C:\Perl\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('N +AME'=>\"Wi n32::LockWorkStation\", 'DLBASE' => 'LockWorkStation', 'DL_FUNCS' => { + }, 'FUNC LIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" Set up gcc environment - 3.4.2 (mingw-special) dlltool --def LockWorkStation.def --output-exp dll.exp c:\Dev-Cpp\bin\g++.exe -o blib\arch\auto\Win32\LockWorkStation +\LockWorkS tation.dll -Wl,--base-file -Wl,dll.base -mdll -L"C:\Perl\lib\CORE" Loc +kWorkStati on.o -Wl,--image-base,0x1b000000 C:\Perl\lib\CORE\perl510.lib c:\Dev- +Cpp\lib\li buser32.a c:\Dev-Cpp\lib\libkernel32.a c:\Dev-Cpp\lib\libuser32.a c:\D +ev-Cpp\lib \libgdi32.a c:\Dev-Cpp\lib\libwinspool.a c:\Dev-Cpp\lib\libcomdlg32.a +c:\Dev-Cpp \lib\libadvapi32.a c:\Dev-Cpp\lib\libshell32.a c:\Dev-Cpp\lib\libole32 +.a c:\Dev- Cpp\lib\liboleaut32.a c:\Dev-Cpp\lib\libnetapi32.a c:\Dev-Cpp\lib\libu +uid.a c:\D ev-Cpp\lib\libws2_32.a c:\Dev-Cpp\lib\libmpr.a c:\Dev-Cpp\lib\libwinmm +.a c:\Dev- Cpp\lib\libversion.a c:\Dev-Cpp\lib\libodbc32.a c:\Dev-Cpp\lib\libodbc +cp32.a c:\ Dev-Cpp\lib\libmsvcrt.a dll.exp g++.exe: LockWorkStation.o: No such file or directory NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code + '0x1' Stop. Admin://{C} # ls LockWorkStation.* Directory of C:\Documents and Settings\Admin\My Documents\tmp\Win32-L +ockWor kStation-0.01 LockWorkStation.bs LockWorkStation.def LockWorkStation.c LockWorkStation.xs 4 File(s) 3,846 bytes Admin://{C} # c:/Dev-Cpp/bin/gcc.exe -c -DNDEBUG -DWIN32 -D +_CONSO LE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN +_INC -DPER L_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READ +FIX -DHASA TTRIBUTE -fno-strict-aliasing -mms-bitfields -O2 -DVERSION=\"0.01\" + -DXS_VER SION=\"0.01\" "-IC:\Perl\lib\CORE" -D_WIN32_WINNT=0x0500 LockWorkSta +tion.c Admin://{C} # ls LockWorkStation.* Directory of C:\Documents and Settings\Admin\My Documents\tmp\Win32-L +ockWor kStation-0.01 LockWorkStation.bs LockWorkStation.def LockWorkStation.xs LockWorkStation.c LockWorkStation.o 5 File(s) 7,913 bytes Admin://{C} #

I've done a lot of Google searching but came up empty. I know the XS code is good because it compiles under MSVC++ and under MingW (if I run it 'manually' instead of via the 'nmake' Makefile). Is there something in the 'perl Makefile.PL' step I'm missing - is there something that needs to be in the Makefile?


In reply to MingW C for XS in ActiveState by VinsWorldcom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.