Subject: Building perl - almost there
From: [email-masked] (Henrik Soderstrom)

26 May 1998 00:27:47 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
To: [email-masked]

I´ve been having an interesting time the last several days,
struggling to build perl-5.004_04 on W95 with Chris Faylor's
patch from "http://www.tiac.net/users/cgf/".

Here's the short story:
(longer one with all the gory details further down)

I believe I´ve been through most of the usual pitfalls judging
by previous posts I could find (even discovered a new pitfall,
see further down). 

.... but I am still having some difficulties:

Any HELP on the following would be welcome:
======================================================================
1. miniperl.exe and perl.exe get built all right but when starting
   to build the dynamically loadable perl extensions the .dll's
   won´t build.
   The command 'dlltool' gets stuck in an infinite loop spewing
   out object files ds1.o ds2.o ds3.o ...
   (stopped it manually with ctrl-C after a thousand odd files.)
   (this happens both with the default gcc and egcs-1.0.2-cygb19)
   Q: Any ideas why it happens and how to fix it ?
2. Is dlltool broken or incompatible with anything ?
3. Is Chris's patch supposed (or known) to work with B19 ?
   (according to his webpage the patch is for B18
    and a B19 version is due soon)
4. From the output of Configure (only happens if patch was applied):
   fork() NOT found.
   *** WHOA THERE!!! ***
       The recommended value for $d_fork on this machine was "define"!
       Keep the recommended value? [y]  
   Q: Was I right to accept the default answer [y] here ?
5. From the output of Configure (only happens if patch was applied):
   As you already told me, signal handler returns void.
   *** WHOA THERE!!! ***
       The recommended value for $d_voidsig on this machine was
"define"!
       Keep the recommended value? [y]  
   Q: Was I right to accept the default answer [y] here ?
6.Other ideas or comments ?

TIA /Henrik

======================================================================

And now the long story, divided up into the following sections:

  1. Platform:
  2. Results so far:
  3. Basic adjustments:
  4. WARNING - NEW PITFALL:
  5. Results - static build:
  6. Results - dynamically loadable:

1. Platform:
============
Win95, 950B + USB patch
Cygwin B19 + coolview of 98-05-19
egcs-1.0.2-cygb19
   (also the default gcc included in B19 - several attempts
    with each)

2. Results so far:
==================
So far I have gotten to a point where I can build a static
perl all right (90 % success rate on the tests) but
compilation of the dynamically loadable perl fails when
it comes to compiling .dll's for the perl extensions.

This is not quite good enough for me - what I really want
is to be able to build and install new perl extensions and
modules as they become available, and so I need the
dynamically loadable perl.

3. Basic adjustments:
=====================
a. In the bash startup .bat file, changed:
   SET GCC_EXEC_PREFIX=D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\
   to
   SET GCC_EXEC_PREFIX=/H-i386-cygwin32/lib/gcc-lib/
   Not sure if this helps but it did seem to get rid of some
   of the warnings.
b. Made sure everything was binary mounted.
c. Introduced some symbolic links:
   ln -s / /gnuwin32
     (the perl distribution expects /gnuwin32/... as default)
   also created links for /etc /bin /lib /usr/bin /usr/lib
   to the corresponding places in the default cygwin tree.
d. Replaced sh.exe
     mv sh.exe ash.exe
     cp bash.exe sh.exe
e. Symlinked the following directory as /gcc-bin and placed
   it in the path:
   In the case of gcc:
     /H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/2.7-B19/
   In the case of egcs:
     /H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/egcs-2.90.27/
   Not sure if this helps but "cpp" was not found otherwise
   and it did seem to get rid of some of the warnings.
f. Unpacked perl-5.004_04 sources under /usr/local/src
   (renamed the lower case "configure" file to "configure.lowercase")
g. Applied Chris Faylor's patch as per instructions.
   (from http://www.tiac.net/users/cgf/)

4. WARNING - NEW PITFALL:
=========================
This one seems easy to overlook, and you're almost guaranteed
to spend many merry hours pulling your hair out - I did anyway.

It so happens that if you have multiple boot configurations
defined in config.sys MSDOS will automatically set the
environment variable $CONFIG for you, $CONFIG="A_W95"
in my case.

Now, it also happens that the 'makedepend' script in the perl
installation relies on the environment variable $CONFIG being
undefined or empty and will go berserk when it isn´t.

Here's a taste of the output:

    Run make depend now? [y]  
    sh ./makedepend MAKE=make
    ./makedepend: /dev/null: No such file or directory
    ./makedepend: -f: command not found
    cp: missing destination file
    Try `cp --help' for more information.
    ./makedepend: $mf: ambiguous redirect
    ./makedepend: -d: command not found
    mkdir: cannot make directory `UU': File exists
    make depend MAKEDEPEND=
    sh ./makedepend MAKE=make
    ./makedepend: /dev/null: No such file or directory
    ./makedepend: -f: command not found
    cp: missing destination file
    Try `cp --help' for more information.
    ./makedepend: $mf: ambiguous redirect
    ./makedepend: -d: command not found
    mkdir: cannot make directory `UU': File exists

    ... and this goes on and on screenful after screenful ...

Once the reason for it was sussed out it was simply solved by
unsetting $CONFIG in the .bat file used to start bash.

5. Results - static build:
==========================
Compilation and installatin OK as far as I can tell, with
a 90 % success rate on the tests:

  Failed 5 test scripts out of 153, 90.20% okay.

However, the perl.exe built this way is not capable of loading
dynamic extensions so it seems you can forget about installing
and using additional perl extensions and modules.

This is not what I'm after, thank you very much - the fight
goes on ...

6. Results - dynamically loadable:
==================================
Compilation went OK up to the point where it starts building
dynamically loadable perl extensions.

On the first such .dll build encountered, the 'dlltool' command
gets stuck in an infinite loop spewing out files named ds1.o
ds2.o ds3.o ds4.o ... ds1234.o ...
(about here is where I stopped it with ctrl-C after a thousand
odd .o files had been written)

Here's the last several lines from the output of make:
....
Extracting pod2text (with variable substitutions)
	AutoSplitting perl library
AutoSplitting Text::ParseWords (lib/auto/Text/ParseWords)
../miniperl minimod.pl > tmp && mv tmp lib/ExtUtils/Miniperl.pm
`sh  cflags libperl.a perlmain.o`  perlmain.c
	  CCCMD =  /usr/local/src/perl5.004_04/cygwin32/gcc2 -DPERL_CORE -c 
-O   

	Making DynaLoader (static)
Writing Makefile for DynaLoader
mkdir ../../lib/auto/DynaLoader
cp DynaLoader.pm ../../lib/DynaLoader.pm
AutoSplitting DynaLoader (../../lib/auto/DynaLoader)
cp dl_cygwin32.xs DynaLoader.xs
.../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp
-noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs >xstmp.c
&& mv xstmp.c DynaLoader.c
/usr/local/src/perl5.004_04/cygwin32/gcc2 -c   -O    -DVERSION=\"1.03\"
-DXS_VERSION=\"1.03\"  -I../.. -DPERL_CORE
-DLIBC="/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib/libcygwin.a"
DynaLoader.c
rm -rf ../../lib/auto/DynaLoader/DynaLoader.a
ar cr ../../lib/auto/DynaLoader/DynaLoader.a DynaLoader.o && :
.../../lib/auto/DynaLoader/DynaLoader.a
chmod 755 ../../lib/auto/DynaLoader/DynaLoader.a
/usr/local/src/perl5.004_04/cygwin32/gcc2   -buildperl  -o perl
perlmain.o lib/auto/DynaLoader/DynaLoader.a  libperl.a `cat ext.libs`
-lcygwin -lm -lkernel32 
perlgcc: building exportable perl...
echo EXPORTS > perl.def
nm lib/auto/DynaLoader/DynaLoader.a libperl.a | grep '^........ [TCD]
_'| grep -v _impure_ptr | sed 's/[^_]*_//' >> perl.def
dlltool --as=as --dllname perl.exe --def perl.def --output-lib perl.a

(The last line is the 'dlltool' command where it hung and had to be
interrupted
 with Ctrl-C):

/Henrik
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".