More VMS patches from Peter Prymmer.
[p5sagit/p5-mst-13.2.git] / README.cygwin
1 If you read this file _as_is_, just ignore the funny characters you
2 see. It is written in the POD format (see pod/perlpod.pod) which is
3 specially designed to be readable as is.
4
5 =head1 NAME
6
7 README.cygwin - Perl for Cygwin
8
9 =head1 SYNOPSIS
10
11 This document will help you configure, make, test and install Perl
12 on Cygwin.  This document also describes features of Cygwin that will
13 affect how Perl behaves at runtime.
14
15 B<NOTE:> There are pre-built Perl packages available for Cygwin and a
16 version of Perl is provided on the Cygwin CD.  If you have no need to
17 customize the configuration, consider using one of these packages:
18
19   http://cygutils.netpedia.net/
20
21 =head1 PREREQUISITES
22
23 =head2 Cygwin = GNU+Cygnus+Windows (Don't leave UNIX without it)
24
25 The Cygwin tools are ports of the popular GNU development tools for Win32
26 platforms.  They run thanks to the Cygwin library which provides the UNIX
27 system calls and environment these programs expect.  More information
28 about this project can be found at:
29
30   http://sourceware.cygnus.com/cygwin/
31
32 A recent net or commercial release of Cygwin is required.
33
34 At the time this document was written, the port required recent
35 development snapshots that were expected to stabilize early in 2000 and
36 be released to the net as B21 and commercially as v1.1.
37
38 B<NOTE:> At this point, minimal effort has been made to provide
39 compatibility with old (beta) Cygwin releases.  The focus has been to
40 provide a high quality release and not worry about working around old
41 Cygwin bugs.  If you wish to use Perl with Cygwin B20.1 or earlier,
42 consider using either perl5.005_03 or perl5.005_62, which are available
43 in source and binary form at C<http://cygutils.netpedia.net/> or on the
44 Cygwin CD.  If there is significant demand, a patch kit can be developed
45 to port back to earlier Cygwin versions.
46
47 =head2 Compiler
48
49 A recent net or commercial release of I<gcc> is required.
50
51 At the time this document was written, I<gcc-2.95.2> was current and
52 could be downloaded from:
53
54   ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/gcc-2.95.2/
55
56 =head2 Cygwin Configuration
57
58 While building Perl some changes may be necessary to your Cygwin setup so
59 that Perl builds cleanly.  These changes are B<not> required for normal
60 Perl usage.
61
62 B<NOTE:> The binaries that are built will run on all Win32 versions.
63 They do not depend on your host system (Win9x, WinNT) or your Cygwin
64 configuration (I<ntea>, I<ntsec>, binary/text mounts).  The only
65 dependencies come from hardcoded pathnames like C</usr/local>.  However,
66 your host system and Cygwin configuration will affect Perl's runtime
67 behavior (see L</"TEST">).  Some regression tests may fail in different
68 ways depending on your setup.  For now, the test suite does not skip
69 tests that do not make sense given a particular setup.  If a test can
70 pass in some Cygwin setup, it is left in and explainable test failures
71 are documented.
72
73 =over 4
74
75 =item * C<PATH>
76
77 Set the C<PATH> environment variable so that Configure finds the Cygwin
78 versions of programs.  Any Windows directories should be removed or
79 moved to the end of your C<PATH>.
80
81 =item * F</bin/cat.exe>
82
83 There should be an instance of I<cat> in F</bin> (or F</usr/bin>).
84 Configure tests C<#!/bin/cat> and if it is not found, you will see
85 the error:
86
87   Configure: ./try: No such file or directory
88
89 =item * F</usr/bin>
90
91 If you do not have a F</usr/bin> directory, Configure will B<not> prompt
92 you to install I<perl> into F</usr/bin>.
93
94 =item * I<nroff>
95
96 If you do not have I<nroff> (which is part of the I<groff> package),
97 Configure will B<not> prompt you to install man pages.
98
99 =item * Permissions
100
101 On WinNT with either the I<ntea> or I<ntsec> C<CYGWIN> settings, directory
102 and file permissions may not be set correctly.  Since the build process
103 creates files and directories, to be safe you may want to run a `C<chmod
104 -R +w *>' on the entire Perl source tree.
105
106 Also, it is a well known WinNT "feature" that files created by a login
107 that is a member of the I<Administrators> group will be owned by the
108 I<Administrators> group.  Depending on your umask, you may find that you
109 can not write to files that you just created (because you are no longer
110 the owner).  When using the I<ntsec> C<CYGWIN> setting, this is not an
111 issue because it "corrects" the ownership to what you would expect on
112 a UNIX system.
113
114 =back
115
116 =head1 CONFIGURE
117
118 The default options gathered by Configure with the assistance of
119 F<hints/cygwin.sh> will build a Perl that supports dynamic loading
120 (which requires a shared F<libperl.dll>).
121
122 This will run Configure and keep a record:
123
124   ./Configure 2>&1 | tee log.configure
125
126 If you are willing to accept all the defaults add a B<-d> option.
127 However, several useful customizations are available.
128
129 =head2 Strip Binaries
130
131 It is possible to strip the EXEs and DLLs created by the build process.
132 The resulting binaries will be significantly smaller.  If you want the
133 binaries to be stripped, you can either add a B<-s> option when Configure
134 prompts you,
135
136   Any additional ld flags (NOT including libraries)? [none] -s
137   Any special flags to pass to gcc to use dynamic linking? [none] -s
138   Any special flags to pass to ld2 to create a dynamically loaded library?
139   [none] -s
140
141 or you can edit F<hints/cygwin.sh> and uncomment the relevant variables
142 near the end of the file.
143
144 =head2 Optional Libraries
145
146 Several Perl functions and modules depend on the existence of
147 some optional libraries.  Configure will find them if they are
148 installed in one of the directories listed as being used for library
149 searches.  Pre-built packages for most of these are available at
150 C<http://cygutils.netpedia.net/>.
151
152 =over 4
153
154 =item * C<-lcrypt>
155
156 The crypt libraries in GNU libc have been ported to Cygwin.
157
158 The DES based Ultra Fast Crypt port was done by Alexey Truhan:
159
160   http://dome.weeg.uiowa.edu/pub/domestic/sos/cw32crypt-dist-0.tgz
161
162 NOTE: There are various export restrictions on DES implementations,
163 see the glibc README for more details.
164
165 The MD5 port was done by Andy Piper:
166
167   http://dome.weeg.uiowa.edu/pub/domestic/sos/libcrypt.tgz
168
169 More information can also be found at:
170
171   http://miracle.geol.msu.ru/sos/
172
173 =item * C<-lgdbm> (C<use GDBM_File>)
174
175 GDBM is available for Cygwin.  GDBM's ndbm/dbm compatibility feature
176 also makes C<NDBM_File> and C<ODBM_File> possible (although they add
177 little extra value).
178
179 =item * C<-ldb> (C<use DB_File>)
180
181 BerkeleyDB is available for Cygwin.  Some details can be found in
182 F<ext/DB_File/DB_File.pm>.
183
184 =item * C<-lcygipc> (C<use IPC::SysV>)
185
186 A port of SysV IPC is available for Cygwin.  It has not been extensively
187 tested.  In particular, C<d_semctl_semun> does not configure properly
188 because the configure test fails and on Win9x the shm*() functions hang.
189
190 =back
191
192 =head2 Configure-time Options
193
194 The F<INSTALL> document describes several Configure-time options.
195 Some of these will work with Cygwin, others are not yet possible.  Also,
196 some of these are experimental.
197
198 =over 4
199
200 =item * C<-Uusedl>
201
202 If you want to force Perl to be compiled statically, you can either
203 choose this when Configure prompts you or you can use the Configure
204 command line option.
205
206 =item * C<-Uusemymalloc>
207
208 By default Perl uses the malloc() included with the Perl source.  If you
209 want to force Perl to build with the system malloc(), you can either
210 choose this when Configure prompts you or you can use the Configure
211 command line option.
212
213 =item * C<-Dusemultiplicty>
214
215 Multiplicity is required when embedding Perl in a C program and using
216 more than one interpreter instance.  This works with the Cygwin port.
217
218 =item * C<-Duseperlio>
219
220 The PerlIO abstraction works with the Cygwin port.
221
222 =item * C<-Duse64bits>
223
224 I<gcc> supports 64-bit integers.  However, several additional long long
225 functions are necessary to use them within Perl (I<{strtol,strtoul}l>).
226 These are B<not> yet available with Cygwin.
227
228 =item * C<-Duselongdouble>
229
230 I<gcc> supports long doubles (12 bytes).  However, several additional
231 long double math functions are necessary to use them within Perl
232 (I<{atan2,cos,exp,floor,fmod,frexp,log,modf,pow,sin,sqrt}l,strtold>).
233 These are B<not> yet available with Cygwin.
234
235 =item * C<-Dusethreads>
236
237 POSIX threads are B<not> yet implemented in Cygwin.
238
239 =item * C<-Duselargefiles>
240
241 Although Win32 supports large files, Cygwin currently uses 32-bit ints
242 for internal size and position calculations.
243
244 =back
245
246 =head2 Suspicious Warnings
247
248 You may see some messages during Configure that seem suspicious.
249
250 =over 4
251
252 =item * Whoa There
253
254 Cygwin does not yet implement chroot(), setegid() or seteuid()
255 functionality, but has stub functions that return C<ENOSYS>.  You will
256 see a message when Configure detects that its guess conflicts with the
257 hint file.
258
259   *** WHOA THERE!!! ***
260       The recommended value for $d_chroot on this machine was "undef"!
261       Keep the recommended value? [y]
262
263 You should keep the recommended value.
264
265 =item * Win9x and d_eofnblk
266
267 Win9x does not correctly report C<EOF> with a non-blocking read on a
268 closed pipe.  You will see the following messages:
269
270   But it also returns -1 to signal EOF, so be careful!
271   WARNING: you can't distinguish between EOF and no data!
272
273   *** WHOA THERE!!! ***
274       The recommended value for $d_eofnblk on this machine was "define"!
275       Keep the recommended value? [y]
276
277 At least for consistency with WinNT, you should keep the recommended
278 value.
279
280 =item * Checking how std your stdio is...
281
282 Configure reports:
283
284   Your stdio doesn't appear very std.
285
286 This is correct.
287
288 =back
289
290 =head1 MAKE
291
292 Simply run make and wait:
293
294   make 2>&1 | tee log.make
295
296 =head2 Warnings
297
298 Warnings like these are normal:
299
300   warning: overriding commands for target <file>
301   warning: ignoring old commands for target <file>
302
303   Warning: no export definition file provided
304   dllwrap will create one, but may not be what you want
305
306 =head2 ld2
307
308 During `C<make>', I<ld2> will be created and installed in your $installbin
309 directory (where you said to put public executables).  It does not
310 wait until the `C<make install>' process to install the I<ld2> script,
311 this is because the remainder of the `C<make>' refers to I<ld2> without
312 fully specifying its path and does this from multiple subdirectories.
313 The assumption is that $installbin is in your current C<PATH>.  If this
314 is not the case or if you do not have an I<install> program, `C<make>'
315 will fail at some point.  If this happens, just manually copy I<ld2>
316 from the source directory to someplace in your C<PATH>.
317
318 =head1 TEST
319
320 There are two steps to running the test suite:
321
322   make test 2>&1 | tee log.make-test
323
324   cd t;./perl harness 2>&1 | tee ../log.harness
325
326 The same tests are run both times, but more information is provided when
327 running as `C<./perl harness>'.
328
329 Test results vary depending on your host system and your Cygwin
330 configuration.  It is possible that Cygwin will pass all the tests,
331 but it is more likely that some tests will fail for one of these reasons.
332
333 =head2 File Permissions
334
335 UNIX file permissions are based on sets of mode bits for
336 {read,write,execute} for each {user,group,other}.  By default Cygwin only
337 tracks the Win32 readonly attribute represented as the UNIX file user
338 write bit (files are always readable, files are executable if they have
339 a F<.{com,bat,exe}> extension or begin with C<#!>, directories are always
340 readable and executable).  On WinNT with the I<ntea> C<CYGWIN> setting,
341 the remaining mode bits are stored as extended attributes.  On WinNT
342 with the I<ntsec> C<CYGWIN> setting, permissions use the standard WinNT
343 security descriptors and access control lists.  Without one of these
344 options, these tests will fail:
345
346   Failed Test           List of failed
347   ------------------------------------
348   io/fs.t               5, 7, 9-10
349   lib/anydbm.t          2
350   lib/db-btree.t        20
351   lib/db-hash.t         16
352   lib/db-recno.t        18
353   lib/gdbm.t            2
354   lib/ndbm.t            2
355   lib/odbm.t            2
356   lib/sdbm.t            2
357   op/stat.t             9, 20 (.tmp not an executable extension)
358
359 =head2 Hard Links
360
361 FAT partitions do not support hard links (whereas NTFS does), in which
362 case Cygwin implements link() by copying the file.  These tests will fail:
363
364   Failed Test           List of failed
365   ------------------------------------
366   io/fs.t               4
367   op/stat.t             3
368
369 =head2 Filetime Granularity
370
371 On FAT partitions the filetime granularity is 2 seconds.  The following
372 test will fail:
373
374   Failed Test           List of failed
375   ------------------------------------
376   io/fs.t               18
377
378 =head2 Tainting Checks
379
380 When Perl is running in taint mode, C<$ENV{PATH}> is considered tainted
381 and not used, so DLLs not in the default system directories will not
382 be found.  While the tests are running you will see warnings popup from
383 the system with messages like:
384
385   Win9x
386     Error Starting Program
387     A required .DLL file, CYGWIN1.DLL, was not found
388
389   WinNT
390     perl.exe or sh.exe - Unable to Locate DLL
391     The dynamic link library cygwin1.dll could not be found in the
392       specified path ...
393
394 Just click OK and ignore them.  When running `C<make test>', 2 popups
395 occur.  During `C<./perl harness>', 4 popups occur.  Also, these tests
396 will fail:
397
398   Failed Test           List of failed
399   ------------------------------------
400   op/taint.t            1, 3, 31, 37
401
402 Alternatively, you can copy F<cygwin1.dll> into one of the Windows system
403 directories (although, this is B<not> recommended).
404
405 =head2 /etc/group
406
407 Cygwin does not require F</etc/group>, in which case the F<op/grent.t>
408 test will be skipped.  The check performed by F<op/grent.t> expects to
409 see entries that use the members field, otherwise this test will fail:
410
411   Failed Test           List of failed
412   ------------------------------------
413   op/grent.t            1
414
415 =head2 Unexplained Failures
416
417 Any additional tests that fail are likely due to bugs in Cygwin or the
418 optional libraries.  It is expected that by the time of the next net
419 release most of these will be solved so they are not described here.
420
421 =head2 Script Portability
422
423 Cygwin does an outstanding job of providing UNIX-like semantics on
424 top of Win32 systems.  However, in addition to the items noted above,
425 there are some differences that you should know about.  This is only a
426 very brief guide to portability, more information can be found in the
427 Cygwin documentation.
428
429 =over 4
430
431 =item * Pathnames
432
433 Cygwin pathnames can be separated by forward (F</>) or backward (F<\>)
434 slashes.  They may also begin with drive letters (F<C:>) or Universal
435 Naming Codes (F<//UNC>).  DOS device names (F<aux>, F<con>, F<prn>,
436 F<com*>, F<lpt?>) are invalid as base filenames.  However, they can be
437 used in extensions (e.g., F<hello.aux>).  Names may not contain these
438 characters:
439
440   : * ? " < > |
441
442 File names are case insensitive, but case preserving.  With the I<mixed>
443 C<CYGWIN> setting, file names are mixed-case (although, directory names
444 remain case insensitive).
445
446 The I<mixed> setting is only available with the "coolview" version of
447 F<cygwin1.dll> provided by Sergey Okhapkin at:
448
449   ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Okhapkin_Sergey/
450
451 =item * Text/Binary
452
453 When a file is opened it is in either text or binary mode.  In text mode
454 a file is subject to CR/LF/Ctrl-Z translations.  With Cygwin, the default
455 mode for an open() is determined by the mode of the mount that underlies
456 the file.  Perl provides a binmode() function to set binary mode on files
457 that otherwise would be treated as text.  sysopen() with the C<O_TEXT>
458 flag sets text mode on files that otherwise would be treated as binary:
459
460     sysopen(FOO, "bar", O_WRONLY|O_CREAT|O_TEXT)
461
462 lseek(), tell() and sysseek() only work with files opened in binary mode.
463
464 The text/binary issue is covered at length in the Cygwin documentation.
465
466 =item * F<.exe>
467
468 The Cygwin stat() makes the F<.exe> extension transparent by looking for
469 a F<foo.exe> when you ask for F<foo> (unless a F<foo> also exists).
470 Cygwin does not require a F<.exe> extension, but I<gcc> adds it
471 automatically when building a program.  However, when accessing an
472 executable as a normal file (e.g., I<install> or I<cp> in a makefile)
473 the F<.exe> is not transparent.
474
475 NOTE: There is a version of I<install> that understands the F<.exe>
476 semantics, it can be found at:
477
478   ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Humblet_Pierre_A/
479
480 =item * chown()
481
482 On WinNT with the I<ntsec> C<CYGWIN> setting, chown() can change a file's
483 user and group IDs.  In all other configurations chown() is a no-op,
484 although this is appropriate on Win9x since there is no security model.
485
486 =item * Miscellaneous
487
488 File locking using the C<F_GETLK> command to fcntl() is a stub that
489 returns C<ENOSYS>.
490
491 Win9x can not rename() an open file (although WinNT can).
492
493 =back
494
495 =head1 INSTALL
496
497 This will install Perl, including man pages.
498
499   make install | tee log.make-install
500
501 NOTE: If C<STDERR> is redirected `C<make install>' will B<not> prompt
502 you to install I<perl> into F</usr/bin>.
503
504 You may need to be I<Administrator> to run `C<make install>'.  If you
505 are not, you must have write access to the directories in question.
506
507 Information on installing the Perl documentation in HTML format can be
508 found in the F<INSTALL> document.
509
510 =head1 MANIFEST
511
512 These are the files in the Perl release that contain references to Cygwin.
513 These very brief notes attempt to explain the reason for all conditional
514 code.  Hopefully, keeping this up to date will allow the Cygwin port to
515 be kept as clean as possible.
516
517 =over 4
518
519 =item Documentation
520
521   INSTALL
522   Changes Changes5.005 Changes5.004
523   AUTHORS MAINTAIN MANIFEST
524   README.cygwin README.win32
525   pod/perl.pod pod/perlfaq3.pod pod/perlhist.pod pod/perlmodlib.pod
526   pod/perlport.pod pod/perltoc.pod pod/perl5004delta.pod
527
528 =item Build, Configure, Make, Install
529
530   cygwin/Makefile.SHs
531   cygwin/ld2.in
532   cygwin/perlld.in
533   ext/IPC/SysV/hints/cygwin.pl
534   ext/NDBM_File/hints/cygwin.pl
535   ext/ODBM_File/hints/cygwin.pl
536   hints/cygwin.sh
537   Porting/patchls       - cygwin in port list
538   Makefile.SH           - linklibperl
539   makedepend.SH         - uwinfix
540   Configure             - help finding hints from uname,
541                           shared libperl required for dynamic loading
542   installman            - man pages with :: translated to .
543   installperl           - install dll/ld2/perlld, install to pods
544
545 =item Tests
546
547   t/io/tell.t           - binmode
548   t/lib/glob-basic.t    - Win32 directory list access differs from read mode
549   t/op/magic.t          - $^X/symlink WORKAROUND, s/.exe//
550   t/op/stat.t           - no /dev, skip Win32 ftCreationTime quirk
551                           (cache manager sometimes preserves ctime of file
552                           previously created and deleted), no -u (setuid)
553
554 =item Compiled Perl Source
555
556   cygwin/cygwin.c       - os_extras (getcwd)
557   doio.c                - win9x can not rename a file when it is open
558   EXTERN.h              - __declspec(dllimport)
559   XSUB.h                - __declspec(dllexport)
560   perl.h                - binmode
561   mg.c                  - environ WORKAROUND
562   util.c                - environ WORKAROUND
563   unixish.h             - environ WORKAROUND
564
565 =item Compiled Module Source
566
567   ext/POSIX/POSIX.xs    - tzname defined externally
568   ext/SDBM_File/sdbm/pair.c
569                         - EXTCONST needs to be redefined from EXTERN.h
570   ext/SDBM_File/sdbm/sdbm.c
571                         - binary open
572
573 =item Perl Modules/Scripts
574
575   lib/perl5db.pl        - use stdin not /dev/tty
576   utils/perlcc.PL       - DynaLoader.a in compile, -DUSEIMPORTLIB
577   utils/perldoc.PL      - version comment
578   lib/File/Spec/Unix.pm - preserve //unc
579   lib/ExtUtils/MakeMaker.pm
580                         - require MM_Cygwin.pm
581   lib/ExtUtils/MM_Cygwin.pm
582                         - canonpath, cflags, manifypods, perl_archive
583   lib/Cwd.pm            - `pwd`
584
585 =back
586
587 =head1 BUGS
588
589 Upon each start, I<make> warns that a rule for F<perlmain.o> is overridden
590 (but there seems to be no better solution than adding an explicit define).
591
592 `C<make clean>' does not remove library F<.def> and F<.exe.stackdump>
593 files.
594
595 The I<ld2> script contains references to the source directory.  You should
596 change these to C</usr/local/bin> (or whatever) after install.
597
598 =head1 AUTHORS
599
600 Charles Wilson E<lt>cwilson@ece.gatech.eduE<gt>,
601 Eric Fifer E<lt>efifer@sanwaint.comE<gt>,
602 alexander smishlajev E<lt>als@turnhere.comE<gt>,
603 Steven Morlock E<lt>newspost@morlock.netE<gt>,
604 Sebastien Barre E<lt>Sebastien.Barre@utc.frE<gt>,
605 Teun Burgers E<lt>burgers@ecn.nlE<gt>.
606
607 =head1 HISTORY
608
609 Last updated: 24 February 2000