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.

Replies are listed 'Best First'.
Re: Is a build a build if it couldn't build?
by chromatic (Archbishop) on Mar 08, 2003 at 08:16 UTC

    As far as I can remember, only one other person has tried to build Perl on Windows with Borland's free compiler. Building on Windows itself is tricky; this is not a system that expects users to compile software. Building with anything besides Cygwin or VS 7 (I believe) is fraught with peril.

    It's probably not so much that Active State doesn't want you to compile things, it's that there are very few people using your toolset. I know p5p would be glad to receive patches to make things compile sanely on more platforms.

Re: Is a build a build if it couldn't build?
by demerphq (Chancellor) on Mar 08, 2003 at 12:08 UTC

    Is a build a build if a build can't build a build?

    A build is a build if a build can build a build using VS7/nmake...

    Z:\AP805\AP805_source\win32>nmake test <snipped> All tests successful, 53 tests and 601 subtests skipped. Files=722, Tests=69370, 730 wallclock secs ( 0.00 cusr + 0.00 csys = + 0.00 CPU) cd ..\win32 Z:\AP805\AP805_source\win32>..\perl.exe -v This is perl, v5.8.0 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2002, Larry Wall Binary build 805 provided by ActiveState Corp. http://www.ActiveState. +com Built 12:31:52 Mar 8 2003

    ;-)

    Seriously though, we need more Win32 people with compilers to build perl and post bug reports and patches and updates. Also, afaik the AS builds and the mainline builds are only slightly different. Installing libwin32 (available from Gurusamy Sarathy) over the mainline build (along with a few extra distributions) gets you an AS distribution pretty much. So patches to the win32 makefiles should go to Perl5Porters and not to AS. Sarathy or Nick Ing Simmons will probably be consulted by the pumpking as to the patches win32 worthyness I'd guess, but I know that there aren't too many vocal Win32 people on P5P, so Im sure any contributions would be appreciated.


    ---
    demerphq
    How much wood would a Woodchuck chuck if Woodchuck could chuck wood?
    A Woodchuck would chuck all the wood he could chuck if a Woodchuck could chuck wood.
    But a Woodchuck can't chuck wood, so a Woodchuck wouldn't chuck any wood at all would he?

Re: Is a build a build if it couldn't build?
by robartes (Priest) on Mar 08, 2003 at 11:40 UTC
    I see no reason why this would be an unpopular post. It shows you being resourceful and trying to fix a problem (or a whole host of problems), and then telling us about it in the hopes of helping some other unfortunate monk faced with the same problem.

    Those of us who have experience porting various GNU & non-GNU open source / free software (I hear the GNU gnu starting to hyperventilate on my using open source and free software in the same context :) ) to various vendor Unices perfectly understand your frustration with this.

    It's a small help (if any), but I tip my hat to you for tackling such a gnarly problem and, despite growing frustration, still managing an informative post about it.

    Needless to say, if you ever get it to compile under your conditions, there will be many people interested in how you did it :)

    CU
    Robartes-

Re: Is a build a build if it couldn't build?
by demerphq (Chancellor) on Mar 08, 2003 at 20:39 UTC

    Hi BrowserUk, I realized that earlier I built AS805 and not 615 (they are on 635 AS release so you should probably redownload). I grabbed 635 just now and tried to build with Borland 5.5 and dmake. No luck. :-(

    I can understand your frustration, but do remember that AS provides the Win32 builds for free. They provide them in a form that will compile out of the box using the standard Win32 C/C++ compiler (VC 5/6/7). Personally I think that if you want to build using Borland be prepared to do a lot of patching, but I'm guessing the win32 P5P would both help, and appreciate the effort.


    ---
    demerphq


Re: Is a build a build if it couldn't build?
by Courage (Parson) on Mar 08, 2003 at 16:45 UTC
    Building on Win32 is no way tricky.

    But after you've said "I chose to use an AS build rather than a CPAN version as I thought..." then I suggest you to do following:

    • download binary from AS
    • use MSVC++ for building of extensions
    • edit Config.pm to reflect your MSVC++ compiler
    • just build your new extensions using normal way: 'perl makefile.pl' and then 'nmake'

    If you really must use Borland compiler, then:

    1. read README.win32 file what it says about Borland C++. Also read "makefile.mk". It contains "BCCOLD" defines which you should set/unset (uncomment). BTW why you did not use newer compiler BCC-5.5?
    2. be prepared to have a bit more than usual number of problems.

    Some compilers are supported better than others, namely Win32 supported by MSVC++ best of all.

    Courage, the Cowardly Dog

      I have downloaded binaries from AS, that's what I've been using for the last 9 months, but I want to move onto using my own build for a variety of reasons.

      I don't have MSVC++.

      If it isn't clear from the above, I have read README.win32--there is no way I would have gotten this far without have done so.

      I am using

      Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland ?

      BCCOLD (nor anything similar to it) appears anywhere in makefile.mk?

      I'm quite comfortable with having some problems, but it seems strange that the build process is set up to use header files from a pre-existing installation of Perl, when building a perl installation. The header files in question are a part of the compiler distribution and the build process should be set to look there for them (it has all the relevant information to find them) rather than as a part of some installed perl, which won't exist if your are building for the first time.

      It was this final contradiction that left me bewildered, confused, and after many hours of trying, intensely frustrated.


      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.
        About "use header files from a pre-existing installation of Perl" - there exists a more general problem in BC++ compiler that they tend to name as "Borland include behaviour" in more recent compilers
        A statement #include "file" has incorrect search order for header file.

        More generally, perl-5.005-03 uses BCC version 5.02 and lower, but not 5.5. Support of 5.5 became in perls starting from 5.6.0 versions.

        I also had some frustrated experience here, sent some corrective patches to p5p list, and sent bug reports to Borland.

        As a side remark, I succeeded to use AS-built perl from within my Borland program, compiler version 5.5 .

        Courage, the Cowardly Dog

Re: Is a build a build if it couldn't build?
by Courage (Parson) on Mar 08, 2003 at 17:00 UTC
    Ok, you have compiler BCC version 5.5.

    Now what is perl version you're trying to build?

    Also you must be sure that a line in makefile.mk "BCCOLD=define" is commented out.

    Courage, the Cowardly Dog