Subject: Solutions for sucessfuly building PERL under W95.
From: Samy Alex ZAIMI <[email-masked]>
To: [email-masked]
Date: Sat, 05 Jun 1999 05:19:53 +0000

Hi everyone,
In the previous posts I complained about the
difficulty to build the dynamically patched PERL
in a W95B environment.
I think I have found a couple of workarounds.
I don't know if they are valid elsewhere than
W95B. Beside, I have a cygwin1.dll from 15 Jan.
Don't know if the following suggestions work with
another dll. My cygnus version is 20.1 with
egcs-1.1.2. (gcc says egcs-2.91.66).
Some feedback by users using other versions is
most welcome.

Q : Why does one need to build PERL ?
A : Because this is recommended by PERL
developpers themselves. PERL works with scripts,
but is also a development tool, especially when
building new modules. And the configuration is
site dependant !!! This means than one needs his
own paths configured during initial build process.

Q : Why do I need a PERL executable with dynamic
loading facility ?
A : PERL comes with so many modules, and most of
them can be dynamically loaded on the fly when
PERL executes your script. This is more convenient
than a version of PERL with a bunch of libraries
statically linked to it. With static version, each
time one needs a library, one needs to recompile
PERL.

Q : Where can I learn more about dynamic libraries
?
A : There is an excellent (IMHO) tutorial that
teaches you step by step how to dynamically link
PERL with C programs. The name of this tutorial is
"perlxstut.html". It is a good way to test the
final installation. The HTML file is part of the
standard PERL's doc package found at
www.perl.{org,com}.

Q : Ok, I am convinced. Are there ready to use
applications ?
A : Sure, if you are interested in producing
PostScript output from within PERL, you can
dynamically load "lipcpgplot", the C library that
belongs to the PGPLOT package. Have a look at :
http://www.aao.gov.au/local/www/kgb/pgperl/
This is the home page of PGPerl. (Personally, I
waited for a dynamic version of PERL to be able to
use this package under W95).

Q : How do I build PERL on a W95 box (without
changing OS or computer) ?
A : Here we go (no need to upgrade to W98, nor NT,
nor W2K) :

0. Check your environment.
a. CYGWIN should contain at least 'binmode notty
title strip_title'.
The last two options are not important. The first
two are. Especially 'notty'. If you have 'tty'
instead, then when the configure script fails,
bash will not recover its initial behaviour (tab
completion, history), and will echo all your
commands twice. Very annoying. So use 'notty'. Be
carefull though : avoid ^C, since it may hang the
computer. Use ^Z instead and kill the job.
b. the .bashrc sould contain MAKE_MODE=UNIX.
Check also GCC_EXEC_PREFIX. It should point to
some gcc-lib/ folder.
c. put '.' in your path.

1. Download 'stable.tar.gz' from a CPAN mirror
site.
CPAN is an acronym for Comprehensive Perl Archive
Network. A good starting point is
www.perl.{org,com}.
Today, the most recent stable version is 5.005_03

2. Download the dynamic build patch at
ftp://belgarion.resnet.gatech.edu/pub/cygwin/B20/perl/

Note, under 'source', a perl tar ball called
'pristine' contains the same things as
'stable.tar.gz' above.
Read the installation instruction there. What
follows is a proposal for a modified procedure.

3. Install files.
In details, untar, copy patch in perl5.005_3,
chmod all files, apply patch.
How to do it is very well explained in the README
file at the above ftp site.

4. Before configuring, some files need to be
changed.
a. Edit 'Configure'.
In line 2676, change
    value=`UU/filexp $ans`
into
    value=`sh UU\filexp $ans`
That's because under W95, `UU/filexp` expands to
UU/UU/filexp, which doesn't exist. This phenomenon
disappears if the shell script is called by sh
instead.
In line 12367 change "deflt=y" into "deflt=n".
That's because we have to change again some things
in the Makefiles produced by Configure before
running 'make depend' and 'make'.
b. Edit all *.SH files in current directory,
x2p/*.SH, and cygwin32/Makefile.SHs.
There are 12 files. In each of them, change '')
below
    case $CONFIG in
into *).
In two files, the change appears twice.
We do that because apparently, $(TOP)/config.sh is
not loaded.
The file "config.sh" is produced by Configure, and
contains settings and variable replacement for
unix commands like cp, mv etc. That's because some
systems need 'copy' and 'move'.
This file is loaded by the *.SH files because
there are some variable replacement to perform
inthere.
If config.sh is not loaded, then
    $(cp) -f foo bar
is expanded into
    -f foo bar
which produces an error. To avoid that, we force
the loading of $(TOP)/config.sh by setting *) in
case list instead of '').
This change has to be done before launching
Configure, because Configure itself creates the
appropriate scripts at the end of configure
process.

5. Run "sh Configure"
I strongly recommend to do that in an xterm window
if you have one. This avoids using the buggy W95
shell window.
I think that rxvt will match (because it avoids
the need for an X11 server).
BTW, if one needs to build PERL, I am sure that
he/she has all the required development slam
(including X11 server and binaries).
One important hint : type return carriage until
you're asked to type "cygwin32" to describe you
installation.
For the very next question, answer "&-d".
Afterwards, the Configure script will not ask you
questions anymore (and you can read your newspaper
:).

6. Edit "config.sh" when the script asks you to do
so.
Be carefull, DO NOT edit the file by a shell
escape '!vi' as suggested. Find another way to do
so (I personally use gvim from WindowsExplorer or
another shell). That's because the shell escape
doesn't take into account all the settings you
might have in .bashrc.
The file "config.sh" is automatically produced by
Configure. This file is important because it goes
into "Config.pm" and contains installation
informations for further compilations with PERL.
What has to be done is :
a. Track empty settings, like for bash, bison,
chgrp, chmod, chown, compress, flex, lint, mv
(!!!), sleep, tail, tar, zcat.
Fill with appropriate names. DO NOT fill split. I
suspect that 'mv' is set to nothing because the
equivalent 'move' on NT always complains if the
target already exists.
b. Remove drive letter from the definition of the
variable 'strings' and 'timeincl'. These variables
point to the full path of headers string.h and
time.h. These will be used by PERL. So avoid 'D:'
or 'F:' at the beginning, because the ':' is
assumed to be a path separator.
c. Change ranlib=':' into ranlib='ranlib'. We have
it. We can use it.
d. Change your Email and hostname settings. (W95
sets unknown).
e. Once this is done, resume Configure. The final
message will recommend you to run "make depend ;
make". Read next first.

7. Edit "Makefile".
Remove some of the lines that were automatically
added by cygwin32/Makefile.SHs (eg. if ... fi).
Just type at this place :
    @install.sh -c -m 755 ld2 /usr/local/bin/ld2
Nothing more. Again, if you really need to build
PERL, I think you must have 'install.sh' installed
somewhere on your path.

8. Run "make depend ; make" or just "make".
There should be no more problems. You can perform
also a "make test" or " cd t ; ./perl harness".
This is what I got :

u=4878.01  s=0  cu=0  cs=0  scripts=182
tests=6454

after "make test", and :

Failed Test  Status Wstat Total Fail  Failed  List
of failed
---------------------------------------------------------

io/argv.t                     6    1  16.67%  6
io/fs.t                      28    1   3.57%  18
io/inplace.t                  2    2 100.00%  1-2
io/iprefix.t                  2    2 100.00%  1-2
lib/sdbm.t                   18    1   5.56%  2
op/stat.t                    58    1   1.72%  9
8 tests skipped, plus 35 subtests skipped.

after "perl harness". Not very drammatic.
To finish, do the usual "make install". Everything
goes into '/usr/local/bin' and
/usr/local/lib/perl5'.

Now, ENJOY !!!
--------
Dr.-Eng. Samy Alex ZAIMI
Tohoku Universit - Sendai (Japan)

--
Want to unsubscribe from this list?
Send a message to [email-masked]