README.cygwin - Perl for Cygwin
This document will help you configure, make, test and install Perl on Cygwin. This document also describes features of Cygwin that will affect how Perl behaves at runtime.
NOTE: There are pre-built Perl packages available for Cygwin and a version of Perl is provided in the normal Cygwin install. If you do not need to customize the configuration, consider using one of those packages.
The Cygwin tools are ports of the popular GNU development tools for Win32 platforms. They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect. More information about this project can be found at:
F<http://www.cygwin.com/>
A recent net or commercial release of Cygwin is required.
At the time this document was last updated, Cygwin 1.5.25 was current.
While building Perl some changes may be necessary to your Cygwin setup so that Perl builds cleanly. These changes are not required for normal Perl usage.
NOTE: The binaries that are built will run on all Win32 versions. They do not depend on your host system (Win9x/WinME, WinNT/Win2K) or your Cygwin configuration (ntsec, binary/text mounts). The only dependencies come from hard-coded pathnames like /usr/local
. However, your host system and Cygwin configuration will affect Perl's runtime behavior (see "TEST").
PATH
Set the PATH
environment variable so that Configure finds the Cygwin versions of programs. Any Windows directories should be removed or moved to the end of your PATH
.
nroff
If you do not have nroff (which is part of the groff package), Configure will not prompt you to install man pages.
Permissions
On WinNT with the default ntsec CYGWIN
settings, directory and file permissions may not be set correctly. Since the build process creates directories and files, to be safe you may want to run a chmod -R u+w *
on the entire Perl source tree.
Also, it is a well known WinNT "feature" that files created by a login that is a member of the Administrators group will be owned by the Administrators group. Depending on your umask, you may find that you can not write to files that you just created (because you are no longer the owner). When using the default ntsec CYGWIN
setting, this is not an issue because it "corrects" the ownership to what you would expect on a UNIX system.
The default options gathered by Configure with the assistance of hints/cygwin.sh will build a Perl that supports dynamic loading which requires a shared cygperl5_8_x.dll and the import library libperl.dll.a.
This will run Configure and keep a record:
./Configure 2>&1 | tee log.configure
If you are willing to accept all the defaults run Configure with -de. However, several useful customizations are available.
It is possible to strip the EXEs and DLLs created by the build process. The resulting binaries will be significantly smaller. If you want the binaries to be stripped, you can either add a -s option when Configure prompts you,
Any additional ld flags (NOT including libraries)? [none] -s
Any special flags to pass to gcc to use dynamic linking? [none] -s
Any special flags to pass to ld2 to create a dynamically loaded library?
[none] -s
or you can edit hints/cygwin.sh and uncomment the relevant variables near the end of the file.
Several Perl functions and modules depend on the existence of some optional libraries. Configure will find them if they are installed in one of the directories listed as being used for library searches. Pre-built packages for most of these are available from the Cygwin installer.
-lcrypt
The crypt package distributed with Cygwin is a Linux compatible 56-bit DES crypt port by Corinna Vinschen.
Alternatively, the crypt libraries in GNU libc have been ported to Cygwin.
The DES based Ultra Fast Crypt port was done by Alexey Truhan:
ftp://ftp.uni-erlangen.de/pub/pc/gnuwin32/cygwin/porters/Okhapkin_Sergey/cw32crypt-dist-0.tgz
NOTE: There are various export restrictions on DES implementations, see the glibc README for more details.
The MD5 port was done by Andy Piper:
ftp://ftp.uni-erlangen.de/pub/pc/gnuwin32/cygwin/porters/Okhapkin_Sergey/libcrypt.tgz
-lgdbm
(use GDBM_File
)
GDBM is available for Cygwin.
NOTE: The GDBM library only works on NTFS partitions.
-ldb
(use DB_File
)
BerkeleyDB is available for Cygwin.
NOTE: The BerkeleyDB library only completely works on NTFS partitions and db-4.3 is flawed.
cygserver
(use IPC::SysV
)
A port of SysV IPC is available for Cygwin.
NOTE: This has not been extensively tested. In particular, d_semctl_semun
is undefined because it fails a Configure test and on Win9x the shm*() functions seem to hang. It also creates a compile time dependency because perl.h includes <sys/ipc.h> and <sys/sem.h> (which will be required in the future when compiling CPAN modules). CURRENTLY NOT SUPPORTED! As with all cygserver
functions this requires the environment variable CYGWIN to contain the magic string server.
-lutil
Included with the standard Cygwin netrelease is the inetutils package which includes libutil.a.
The INSTALL document describes several Configure-time options. Some of these will work with Cygwin, others are not yet possible. Also, some of these are experimental. You can either select an option when Configure prompts you or you can define (undefine) symbols on the command line.
-Uusedl
Undefining this symbol forces Perl to be compiled statically.
-Uusemymalloc
By default Perl uses the malloc()
included with the Perl source. If you want to force Perl to build with the system malloc()
undefine this symbol.
-Uuseperlio
Undefining this symbol disables the PerlIO abstraction. PerlIO is now the default; it is not recommended to disable PerlIO.
-Dusemultiplicity
Multiplicity is required when embedding Perl in a C program and using more than one interpreter instance. This works with the Cygwin port.
-Duse64bitint
By default Perl uses 32 bit integers. If you want to use larger 64 bit integers, define this symbol. This is now the default.
-Duselongdouble
gcc supports long doubles (12 bytes). However, several additional long double math functions are necessary to use them within Perl ({atan2, cos, exp, floor, fmod, frexp, isnan, log, modf, pow, sin, sqrt}l, strtold). These are not yet available with Cygwin.
-Dusethreads
POSIX threads are implemented in Cygwin, define this symbol if you want a threaded perl.
-Duselargefiles
Cygwin uses 64-bit integers for internal size and position calculations, this will be correctly detected and defined by Configure.
-Dmksymlinks
Use this to build perl outside of the source tree. This works with Cygwin. Details can be found in the INSTALL document. This is the recommended way to build perl from sources.
You may see some messages during Configure that seem suspicious.
Win9x and d_eofnblk
Win9x does not correctly report EOF
with a non-blocking read on a closed pipe. You will see the following messages:
But it also returns -1 to signal EOF, so be careful!
WARNING: you can't distinguish between EOF and no data!
*** WHOA THERE!!! ***
The recommended value for $d_eofnblk on this machine was "define"!
Keep the recommended value? [y]
At least for consistency with WinNT, you should keep the recommended value.
Compiler/Preprocessor defines
The following error occurs because of the Cygwin #define
of _LONG_DOUBLE
:
Guessing which symbols your C compiler and preprocessor define...
try.c:<line#>: missing binary operator
This failure does not seem to cause any problems. With older gcc versions, "parse error" is reported instead of "missing binary operator".
Simply run make and wait:
make 2>&1 | tee log.make