What follows is a blow-by-blow description of my attempts to build an Active State distribution of the perl source code. I chose to use an AS build rather than a CPAN version as I thought that they are 'the experts' on win32 vareties of Perl, and would probably have sorted out most of the bugs.

This time, I attempted to use BCC55/Dmake v4.10 PL1 and AS distribution AP615_Source.tar. I've previously tried to build this using MingW without success.

If anyone questions the reasons why I am posting this, maybe they would like to skip to the end and read the questions I pose there. I don't expect this to be a popular post, but I think it important that it is on-the-record. I'm also quite prepared that someone with more experience of the Perl build process will spot some fundemental flaw in my attempts, and if they do I will apologise for wasting everyones time with this.

Some of the commantary below was made in the context of me illiciting help from another monk, and may not make complete sense out of that context.

E:\Perl\src\AP615_source\win32>dmake del /f config.h Could Not Find E:\Perl\src\AP615_source\win32\config.h copy config_H.bc config.h 1 file(s) copied. bcc32 -c -w -g0 -tWM -tWD -I..\lib\CORE -I.\include -I. -I.. -I"e:\bc +c55\include" -DWIN32 -DHAVE_DES_FCRYPT -DPERLDLL -DPERL_CORE -O2 -D_RTLDLL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -op +erlglob.obj perlglob.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perlglob.c: bcc32 -c -w -v -tWM -I"e:\bcc55\include" perlglob.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perlglob.c: tlink32 -Tpe -ap -L"t: \lib\CORE" -L"e:\bcc55\lib" c0x32.obj perlglob.obj \ "e:\bcc55\lib\32BIT\wildargs.obj",..\perlglob.exe,,import3 +2.lib cw32mt.lib, The name specified is not recognized as an internal or external command, operable program or batch file. dmake.exe: Error code 1, while making '..\perlglob.exe' E:\Perl\src\AP615_source\win32>

As you can see, almost immediatly the build fails because it can't find the command tlink32.exe...which is hardly surprising as there IS no such command in the distribution of BCC I have. The (I assume equivalent) command is ilink32 as you can see from the directory listing below.

If I fix this, I just move forward to the next error... and the next and the next.

Unsurprisingly, I figured that maybe there was some step missing from the README.win32 or maybe Makefile.mk or, I was using the wrong linker...

E:\BCC55\Bin>dir Volume in drive E has no label. Volume Serial Number is B41D-3949 Directory of E:\BCC55\Bin 03/03/06 03:47a <DIR> . 03/03/06 03:47a <DIR> .. 00/06/27 05:01a 869,376 bcc32.exe 00/06/27 05:01a 69,152 brc32.exe 00/06/27 05:01a 168,992 brcc32.exe 00/06/27 05:01a 572 builtins.mak 00/06/27 05:01a 1,405,440 cc3250.dll 00/06/27 05:01a 1,497,088 cc3250mt.dll 00/06/27 05:01a 118,485 coff2omf.exe 00/06/27 05:01a 241,152 cpp32.exe 98/12/09 02:05a 131,072 dmake.exe 00/06/27 05:01a 19,456 fconvert.exe 00/06/27 05:01a 102,400 grep.exe 00/06/27 05:01a 326,144 ilink32.exe 00/06/27 05:01a 169,472 impdef.exe 00/06/27 05:01a 192,000 implib.exe 00/06/27 05:01a 93,696 lnkdfm50.dll 00/06/27 05:01a 114,688 make.exe 00/06/27 05:01a 74,752 rlink32.dll 00/06/27 05:01a 812,576 rw32core.dll 03/03/06 03:47a <DIR> startup 00/06/27 05:01a 261,120 tdump.exe 00/06/27 05:01a 61,440 tlib.exe 00/06/27 05:01a 73,728 touch.exe 00/06/27 05:01a 16,460 trigraph.exe 26 File(s) 6,819,639 bytes 1,629,994,496 bytes free E:\BCC55\Bin>

To reenforce what I mean, when I modify makefile.mk to use ilink32.exe instead of tlink32.exe, I get this error instead.

E:\Perl\src\AP615_source\win32>dmake del /f config.h copy config_H.bc config.h 1 file(s) copied. bcc32 -c -w -v -tWM -I"e:\bcc55\include" perlglob.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perlglob.c: ilink32 -Tpe -ap -L"t: \lib\CORE" -L"e:\bcc55\lib" c0x32.obj perlglob.obj \ "e:\bcc55\lib\32BIT\wildargs.obj",..\perlglob.exe,,import3 +2.lib cw32mt.lib, Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Fatal: Illegal option: Lt: dmake.exe: Error code 2, while making '..\perlglob.exe' E:\Perl\src\AP615_source\win32>

After editing Makefile.mk, the build moves along a bit further until

E:\Perl\src\AP615_source\win32>dmake del /f config.h copy config_H.bc config.h 1 file(s) copied. bcc32 -c -w -g0 -tWM -tWD -I..\lib\CORE -I.\include -I. -I.. -I"e:\bc +c55\include" -DWIN32 -DHAVE_DES_FCRYPT -DPERLDLL -DPERL_CORE -O2 -D_RTLDLL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -op +erlglob.obj perlglob.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perlglob.c: bcc32 -c -w -v -tWM -I"e:\bcc55\include" perlglob.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland perlglob.c: ilink32 -Tpe -ap -L"t:\.\lib\CORE" -L"e:\bcc55\lib" c0x32.obj perlgl +ob.obj \ "e:\bcc55\lib\32BIT\wildargs.obj",..\perlglob.exe,,import3 +2.lib cw32mt.lib, Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland bcc32 -c -w -g0 -tWM -tWD -I..\lib\CORE -I.\include -I. -I.. -I"e:\bcc +55\include" -DWIN32 -DHAVE_DES_FCRYPT -DPERLDLL -DPERL_CORE -O2 -D_RTLDLL -o.\mini\win32.obj win32.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland win32.c: Warning W8017 win32.h 164: Redefinition of '_access' is not identical Warning W8075 win32.c 1137: Suspicious pointer conversion in function +win32_stat Error E2451 win32.c 1616: Undefined symbol 'u' in function win32_uname *** 1 errors in Compile *** dmake.exe: Error code 1, while making '.\mini\win32.obj' E:\Perl\src\AP615_source\win32>

Inspecting the source of win32.c:1616 I find this

#if defined(__BORLANDC__) || defined(__MINGW32__) switch (info.u.s.wProcessorArchitecture) { <<< line:1616 #else switch (info.wProcessorArchitecture) { #endif

Okay I tracked down the definition of the SYSTEM_INFO structure to BCC55\include\winbase.h

typedef struct _SYSTEM_INFO { union { DWORD dwOemId; // Obsolete field...do not use struct { WORD wProcessorArchitecture; WORD wReserved; }; }; DWORD dwPageSize; LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress; DWORD_PTR dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAllocationGranularity; WORD wProcessorLevel; WORD wProcessorRevision; } SYSTEM_INFO, *LPSYSTEM_INFO;

No .u.s fields, so edit win32.c to remove the spurious conditional for BORLAND and MINGW

/*1614 #if defined(__BORLANDC__) || defined(__MINGW32__) switch (info.u.s.wProcessorArchitecture) { #else switch (info.wProcessorArchitecture) { #endif 1620*/ switch (info.wProcessorArchitecture) {

Next problem

E:\Perl\src\AP615_source\win32>dmake del /f config.h copy config_H.bc config.h 1 file(s) copied. ilink32 -Tpe -ap -L"t:\.\lib\CORE" -L"e:\bcc55\lib" \ @D:\TEMP\mk000001 Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Fatal: Unable to open file 'ODBC32.LIB' dmake.exe: Error code 2, while making '..\miniperl.exe' E:\Perl\src\AP615_source\win32>

Can't find ODBC32.lib in t:\.\lib\CORE, not surprising, doesn't exist yet. Or e:\bcc55\lib...there isn't one.

E:\BCC55\Lib>dir Volume in drive E has no label. Volume Serial Number is B41D-3949 Directory of E:\BCC55\Lib 03/03/05 08:37p <DIR> . 03/03/05 08:37p <DIR> .. 00/06/27 05:01a 2,758 c0d32.obj 00/06/27 05:01a 2,761 c0d32w.obj 00/06/27 05:01a 2,667 c0d32x.obj 00/06/27 05:01a 3,519 c0s32.obj 00/06/27 05:01a 2,302 c0w32.obj 00/06/27 05:01a 2,308 c0w32w.obj 00/06/27 05:01a 2,279 c0x32.obj 00/06/27 05:01a 2,304 c0x32w.obj 00/06/27 05:01a 1,644,544 cw32.lib 00/06/27 05:01a 501,248 cw32i.lib 00/06/27 05:01a 1,722,368 cw32mt.lib 00/06/27 05:01a 511,488 cw32mti.lib 00/06/27 05:01a 7,168 dxextra.lib 00/06/27 05:01a 185 fileinfo.obj 00/06/27 05:01a 852 gp.obj 00/06/27 05:01a 710,656 import32.lib 00/06/27 05:01a 29,184 inet.lib 00/06/27 05:01a 3,584 noeh32.lib 00/06/27 05:01a 47,616 ole2w32.lib 00/06/27 05:01a 12,745 oleaut32.lib 03/03/05 08:37p <DIR> PSDK 00/06/27 05:01a 2,048 uuid.lib 00/06/27 05:01a 271 wildargs.obj 00/06/27 05:01a 18,944 wininet.lib 00/06/27 05:01a 8,704 ws2_32.lib 27 File(s) 5,242,503 bytes 1,627,738,112 bytes free E:\BCC55\Lib>

What to do? Search the makefile and remove this dependancy? Is there any other option? Hmm, use the dmake -vt option to retain the mk000001 tempfile and edit that and hope that it will be reused. Might allow me to see if the ODBC32.lib is required for this file before I monkey further with the makefile.mk.

No good, dmake overwrote it. It'll have to be the makefile.

Commented out the dependancies of odbc32.lib and odbccp32.lib

342: LIBFILES    = $(CRYPT_LIB) import32.lib $(LIBC) # odbc32.lib odbccp32.lib

And surprisingly not only did that file build so did 20 or so more. I even dared to hope it might complete for a few minutes but then

E:\Perl\src\AP615_source\win32>dmake ECHO is on. cd ..\ext\Socket && \ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl Writing Makefile for Socket cd ..\ext\Socket && e:\BCC55\bin\dmake.exe -S bcc32 -c -O2 -D_RTLDLL -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONT +EXT -DPERL_IMPLICIT_SYS -O2 -D_RTLDLL -DVERSION=\"1.72 \" -DXS_VERSION=\"1.72\" -I..\..\lib\CORE Socket.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland Socket.c: Error E2209 ..\..\lib\CORE\perl.h 425: Unable to open include file 'sy +s/types.h' Error E2209 ..\..\lib\CORE\perl.h 436: Unable to open include file 'st +darg.h' Error E2209 ..\..\lib\CORE\perl.h 456: Unable to open include file 'ct +ype.h' Error E2209 ..\..\lib\CORE\perl.h 464: Unable to open include file 'lo +cale.h' Error E2209 ..\..\lib\CORE\perl.h 481: Unable to open include file 'se +tjmp.h' Error E2209 ..\..\lib\CORE\perl.h 514: Unable to open include file 'st +ring.h' Error E2209 ..\..\lib\CORE\perl.h 669: Unable to open include file 'sy +s/stat.h' Error E2209 ..\..\lib\CORE\perl.h 691: Unable to open include file 'ti +me.h' Error E2209 ..\..\lib\CORE\perl.h 712: Unable to open include file 'er +rno.h' Error E2209 ..\..\lib\CORE\perl.h 1085: Unable to open include file 'l +imits.h' Error E2209 ..\..\lib\CORE\perl.h 1088: Unable to open include file 'f +loat.h' Error E2209 ..\..\lib\CORE\perl.h 1095: Unable to open include file 'f +loat.h' Error E2209 ..\..\lib\CORE\perl.h 1113: Unable to open include file 'l +imits.h' Error E2209 ..\..\lib\CORE\perl.h 1116: Unable to open include file 'f +loat.h' Error E2209 ..\..\lib\CORE\perl.h 1207: Unable to open include file 'l +imits.h' Error E2257 ..\..\lib\CORE\perl.h 1388: , expected Error E2209 ..\..\lib\CORE\win32.h 60: Unable to open include file 'wi +ndows.h' Error E2209 ..\..\lib\CORE\win32.h 71: Unable to open include file 'io +.h' Error E2209 ..\..\lib\CORE\win32.h 72: Unable to open include file 'pr +ocess.h' Error E2209 ..\..\lib\CORE\win32.h 73: Unable to open include file 'st +dio.h' Error E2209 ..\..\lib\CORE\win32.h 74: Unable to open include file 'di +rect.h' Error E2209 ..\..\lib\CORE\win32.h 75: Unable to open include file 'st +dlib.h' Error E2209 ..\..\lib\CORE\win32.h 76: Unable to open include file 'fc +ntl.h' Error E2209 ..\..\lib\CORE\win32.h 168: Unable to open include file 's +ys/types.h' Error E2141 ..\..\lib\CORE\win32.h 281: Declaration syntax error Error E2228 ..\..\lib\CORE\win32.h 281: Too many error or warning mess +ages *** 26 errors in Compile *** dmake.exe: Error code 1, while making 'Socket.obj' dmake.exe: Error code 255, while making '..\lib\auto\Socket\Socket.dl +l' E:\Perl\src\AP615_source\win32>

After much head scratching, the problem is that in the makefile.mk, the rule for building socket.c is this

$(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs cd $(EXTDIR)\$(*B) && \ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl cd $(EXTDIR)\$(*B) && $(MAKE)
which is the standard XS style Makefile.pl using ExtUtils::MakeMaker to build a makefile, then invoke that makefile to build the extension. However, the Makefile.pl looks like this:

use ExtUtils::MakeMaker; use Config; WriteMakefile( NAME => 'Socket', VERSION_FROM => 'Socket.pm', ($Config{libs} =~ /(-lsocks\S*)/ ? (LIBS => [ "$1" ] ) : ()), MAN3PODS => {}, # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? );

The significant bit appears to be that it is using the value of the currently defined $Config{lib} to decide where the standard C header files (sys/types.h etc) are located.

GOTCHA! The problem (I think) with this is that whilst this may work fine for building extensions onto a pre-existing installed version of perl, when your actually trying to build perl, EITHER THERE IS NO %Config (because your building perl for the first time) OR THERE IS, but it doesn't make sense to use these headers (if they existed which they don't on my pre-built installed versions of perl), as they probably related to a completely different complier suit!!!!

The headers I need to use, are those that exist in the compiler BCC55\Include directory, and whilst I have a macro in the top level makefile.mk that points to this, there is no way to pass this value into the Makefile.pl('s) used to build the extensions.

The only way I see to move beyond this impass is to manually edit each of the 38 Makefile.pl(s) that come with the CORE distribution to point them at the compilers Incluse directories instead of the lib\CORE, which in any case doesn't (*^*&*^ exist yet.

How can this ever work for anyone? If it never can work for anyone, why do Active State bother making these distributions available? Is this purely paying lip-service to the Perl licence agreement that they must make the sources of any binary builds they distribute available?

Isn't it implied, if not actually stated that the builds they make available should actually build?


Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.

In reply to Is a build a build if it couldn't build? by BrowserUk

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.