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

Hi, This question relates specifically to building perl-5.8.0 from source on Win32 using MinGW and dmake. (I have no problem with building 5.8.3 onwards.)

The error(s) killing the process:
D:/MinGW/bin/../libexec/gcc/mingw32/3.4.4/collect2.exe --subsystem con +sole -Bdynamic -o ..\miniperl.exe D:/MinGW/bin/../lib/gcc/mingw32/3.4 +.4/../../../crt2.o D:/MinGW/bin/../lib/gcc/mingw32/3.4.4/crtbegin.o - +LE:\perl580_M\lib\CORE -LD:\MinGW\lib -LD:/MinGW/bin/../lib/gcc/mingw +32/3.4.4 -LD:/MinGW/bin/../lib/gcc -LD:/MinGW/bin/../lib/gcc/mingw32/ +3.4.4/../../../../mingw32/lib -LD:/MinGW/bin/../lib/gcc/mingw32/3.4.4 +/../../.. C:\DOCUME~1\Rob\LOCALS~1\Temp\mk2 -lmingw32 -lgcc -lmoldnam +e -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw +32 -lgcc -lmoldname -lmingwex -lmsvcrt D:/MinGW/bin/../lib/gcc/mingw3 +2/3.4.4/crtend.o D:\MinGW\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe:C +:\DOCUME~1\Rob\LOCALS~1\Temp\mk2: file format not recognized; treatin +g as linker script D:\MinGW\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe:C +:\DOCUME~1\Rob\LOCALS~1\Temp\mk2:1: syntax error collect2: ld returned 1 exit status dmake: Error code 129, while making '..\miniperl.exe'

There's a reference in there to 'C:\DOCUME~1\Rob\LOCALS~1\Temp\mk2' which, afaict, does not exist either as a file or a directory, so my first thought was to remove that from the collect2.exe command. But when I manually enter the amended command I get a fatal complaint about WinMain@16:
D:/MinGW/bin/../libexec/gcc/mingw32/3.4.4/collect2.exe --subsystem co +nsole -Bdynamic -o ..\miniperl.exe D:/MinGW/bin/../lib/gcc/mingw32/3. +4.4/../../../crt2.o D:/MinGW/bin/../lib/gcc/mingw32/3.4.4/crtbegin.o +-LE:\perl580_M\lib\CORE -LD:\MinGW\lib -LD:/MinGW/bin/../lib/gcc/ming +w32/3.4.4 -LD:/MinGW/bin/../lib/gcc -LD:/MinGW/bin/../lib/gcc/mingw32 +/3.4.4/../../../../mingw32/lib -LD:/MinGW/bin/../lib/gcc/mingw32/3.4. +4/../../.. -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lk +ernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lm +svcrt D:/MinGW/bin/../lib/gcc/mingw32/3.4.4/crtend.o D:\MinGW\lib/libmingw32.a(main.o): In function `main':d:/src/mingw/bui +ld/runtime/../../runtime/main.c:73: undefined reference to `WinMain@1 +6' collect2: ld returned 1 exit status

Any advice ?
Anyone ever built 5.8.0 from source with MinGW and dmake on Win32 ?

I've just built some binaries using perl-5.8.8, hoping they would be usable on all earlier perls (back to 5.8.0), but there's a backwards incompatibility issue regarding 'PL_memory_wrap' (which doesn't seem to have arrived on the scene until 5.8.7). But ... do I really need to build using 5.8.0 to avoid binary-incompatibility issues ? Perhaps if I build with 5.8.6 (or 5.8.3), that would be good enough ? Any thoughts about that, too, would also be appreciated. If it turns out that there's no need for me to bother building perl-5.8.0, then ... ummm ... I probably won't bother :-)

Cheers,
Rob

Replies are listed 'Best First'.
Re: perl-5.8.0 on Win32 with MinGW/dmake ... working around PL_memory_wrap issue
by xdg (Monsignor) on Sep 05, 2006 at 12:03 UTC
    I really need to build using 5.8.0 to avoid binary-incompatibility issues

    This sounds like an XY Problem. What are you trying to accomplish that binary compatibility is an issue for you?

    Separately, it looks like your TEMP directory is pointing into your "C:\Documents and Settings". Building Perl involving directories with spaces in them could cause strange side effects due to poor command-line argument quoting. Try setting $ENV{TEMP} to "C:\temp" (and create that directory if it doesn't exist) and see if that helps.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      What are you trying to accomplish that binary compatibility is an issue for you?

      I'd like to build build a PDL-2.4.3 win32 binary that works on perl 5.8.0 to 5.8.8 (and provides additional functionality to the ppm packages provided by activestate and uwinnipeg). I built such a binary using perl 5.8.8, but it works only on 5.8.7 and 5.8.8 because PL_memory_wrap does not exist in pre-5.8.7 perls.

      The idea about spaces being the problem was worth a try ... but the problem persists. I think spaces are a problem only when the directory is specified as "C:\Documents and Settings\Rob\Local Settings\Temp" instead of "C:\DOCUME~1\Rob\LOCALS~1\Temp". (Note that the latter form doesn't contain any spaces.)

      I'm aware of the PAR issue that randyk mentioned. I don't think it will apply to what I'm trying to do ... I hope not. Anyway, looks like I'd better go the extra yards and build the binary using perl 5.8.0. If I can't build 5.8.0 myself with MinGW, then I'll just grab an ActiveState build of 5.8.0 and use it (with MinGW and ExtUtils::FakeConfig) to build the binary.

      Thanks guys.

      Cheers,
      Rob
Re: perl-5.8.0 on Win32 with MinGW/dmake ... working around PL_memory_wrap issue
by randyk (Parson) on Sep 05, 2006 at 15:26 UTC

    But ... do I really need to build using 5.8.0 to avoid binary-incompatibility issues ?
    If MinGW behaves the same way as VC++, then yes, you do need to build binaries with 5.8.0 in general for binary compatibility with all 5.8.x. ActiveState builds their ppm packages with 5.8.0 for exactly this reason.

    However, just to add a bit of confusion, see the discussion on Windows + Tk + PAR == PL_memory_wrap error, for which a PAR ppm package built with 5.8.0 did not work on a perl-5.8.7; for this, one needed to use a ppm package built with 5.8.7 (the same problem occurs with perl-5.8.8).