📄 perlcygwin.1
字号:
want to force Perl to build with the system \f(CW\*(C`malloc()\*(C'\fR undefine this symbol..IP "\(bu" 4\&\f(CW\*(C`\-Uuseperlio\*(C'\fR.SpUndefining this symbol disables the PerlIO abstraction. PerlIO is now thedefault; it is not recommended to disable PerlIO..IP "\(bu" 4\&\f(CW\*(C`\-Dusemultiplicity\*(C'\fR.SpMultiplicity is required when embedding Perl in a C program and usingmore than one interpreter instance. This works with the Cygwin port..IP "\(bu" 4\&\f(CW\*(C`\-Duse64bitint\*(C'\fR.SpBy default Perl uses 32 bit integers. If you want to use larger 64bit integers, define this symbol..IP "\(bu" 4\&\f(CW\*(C`\-Duselongdouble\*(C'\fR.Sp\&\fIgcc\fR supports long doubles (12 bytes). However, several additionallong double math functions are necessary to use them within Perl(\fI{atan2, cos, exp, floor, fmod, frexp, isnan, log, modf, pow, sin, sqrt}l,strtold\fR).These are \fBnot\fR yet available with Cygwin..IP "\(bu" 4\&\f(CW\*(C`\-Dusethreads\*(C'\fR.Sp\&\s-1POSIX\s0 threads are implemented in Cygwin, define this symbol if you wanta threaded perl..IP "\(bu" 4\&\f(CW\*(C`\-Duselargefiles\*(C'\fR.SpCygwin uses 64\-bit integers for internal size and position calculations,this will be correctly detected and defined by Configure..IP "\(bu" 4\&\f(CW\*(C`\-Dmksymlinks\*(C'\fR.SpUse this to build perl outside of the source tree. This works with Cygwin.Details can be found in the \fI\s-1INSTALL\s0\fR document. This is the recommendedway to build perl from sources..Sh "Suspicious Warnings on Cygwin".IX Subsection "Suspicious Warnings on Cygwin"You may see some messages during Configure that seem suspicious..IP "\(bu" 4Win9x and \f(CW\*(C`d_eofnblk\*(C'\fR.SpWin9x does not correctly report \f(CW\*(C`EOF\*(C'\fR with a non-blocking read on aclosed pipe. You will see the following messages:.Sp.Vb 2\& But it also returns \-1 to signal EOF, so be careful!\& WARNING: you can\*(Aqt distinguish between EOF and no data!\&\& *** WHOA THERE!!! ***\& The recommended value for $d_eofnblk on this machine was "define"!\& Keep the recommended value? [y].Ve.SpAt least for consistency with WinNT, you should keep the recommendedvalue..IP "\(bu" 4Compiler/Preprocessor defines.SpThe following error occurs because of the Cygwin \f(CW\*(C`#define\*(C'\fR of\&\f(CW\*(C`_LONG_DOUBLE\*(C'\fR:.Sp.Vb 2\& Guessing which symbols your C compiler and preprocessor define...\& try.c:<line#>: missing binary operator.Ve.SpThis failure does not seem to cause any problems. With older gccversions, \*(L"parse error\*(R" is reported instead of \*(L"missing binaryoperator\*(R"..SH "MAKE ON CYGWIN".IX Header "MAKE ON CYGWIN"Simply run \fImake\fR and wait:.PP.Vb 1\& make 2>&1 | tee log.make.Ve.SH "TEST ON CYGWIN".IX Header "TEST ON CYGWIN"There are two steps to running the test suite:.PP.Vb 1\& make test 2>&1 | tee log.make\-test\&\& cd t; ./perl harness 2>&1 | tee ../log.harness.Ve.PPThe same tests are run both times, but more information is provided whenrunning as \f(CW\*(C`./perl harness\*(C'\fR..PPTest results vary depending on your host system and your Cygwinconfiguration. If a test can pass in some Cygwin setup, it is alwaysattempted and explainable test failures are documented. It is possiblefor Perl to pass all the tests, but it is more likely that some testswill fail for one of the reasons listed below..Sh "File Permissions on Cygwin".IX Subsection "File Permissions on Cygwin"\&\s-1UNIX\s0 file permissions are based on sets of mode bits for{read,write,execute} for each {user,group,other}. By default Cygwinonly tracks the Win32 read-only attribute represented as the \s-1UNIX\s0 fileuser write bit (files are always readable, files are executable if theyhave a \fI.{com,bat,exe}\fR extension or begin with \f(CW\*(C`#!\*(C'\fR, directories arealways readable and executable). On WinNT with the \fIntea\fR \f(CW\*(C`CYGWIN\*(C'\fRsetting, the additional mode bits are stored as extended file attributes.On WinNT with the default \fIntsec\fR \f(CW\*(C`CYGWIN\*(C'\fR setting, permissions use thestandard WinNT security descriptors and access control lists. Without one ofthese options, these tests will fail (listing not updated yet):.PP.Vb 12\& Failed Test List of failed\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\& io/fs.t 5, 7, 9\-10\& lib/anydbm.t 2\& lib/db\-btree.t 20\& lib/db\-hash.t 16\& lib/db\-recno.t 18\& lib/gdbm.t 2\& lib/ndbm.t 2\& lib/odbm.t 2\& lib/sdbm.t 2\& op/stat.t 9, 20 (.tmp not an executable extension).Ve.Sh "NDBM_File and ODBM_File do not work on \s-1FAT\s0 filesystems".IX Subsection "NDBM_File and ODBM_File do not work on FAT filesystems"Do not use NDBM_File or ODBM_File on \s-1FAT\s0 filesystem. They can bebuilt on a \s-1FAT\s0 filesystem, but many tests will fail:.PP.Vb 6\& ../ext/NDBM_File/ndbm.t 13 3328 71 59 83.10% 1\-2 4 16\-71\& ../ext/ODBM_File/odbm.t 255 65280 ?? ?? % ??\& ../lib/AnyDBM_File.t 2 512 12 2 16.67% 1 4\& ../lib/Memoize/t/errors.t 0 139 11 5 45.45% 7\-11\& ../lib/Memoize/t/tie_ndbm.t 13 3328 4 4 100.00% 1\-4\& run/fresh_perl.t 97 1 1.03% 91.Ve.PPIf you intend to run only on \s-1FAT\s0 (or if using AnyDBM_File on \s-1FAT\s0),run Configure with the \-Ui_ndbm and \-Ui_dbm options to preventNDBM_File and ODBM_File being built..PPWith \s-1NTFS\s0 (and no CYGWIN=nontsec), there should be no problems even ifperl was built on \s-1FAT\s0..ie n .Sh """fork()"" failures in io_* tests".el .Sh "\f(CWfork()\fP failures in io_* tests".IX Subsection "fork() failures in io_* tests"A \f(CW\*(C`fork()\*(C'\fR failure may result in the following tests failing:.PP.Vb 3\& ext/IO/lib/IO/t/io_multihomed.t\& ext/IO/lib/IO/t/io_sock.t\& ext/IO/lib/IO/t/io_unix.t.Ve.PPSee comment on fork in Miscellaneous below..SH "Specific features of the Cygwin port".IX Header "Specific features of the Cygwin port".Sh "Script Portability on Cygwin".IX Subsection "Script Portability on Cygwin"Cygwin does an outstanding job of providing UNIX-like semantics on top ofWin32 systems. However, in addition to the items noted above, there aresome differences that you should know about. This is a very brief guideto portability, more information can be found in the Cygwin documentation..IP "\(bu" 4Pathnames.SpCygwin pathnames can be separated by forward (\fI/\fR) or backward (\fI\e\e\fR)slashes. They may also begin with drive letters (\fIC:\fR) or UniversalNaming Codes (\fI//UNC\fR). \s-1DOS\s0 device names (\fIaux\fR, \fIcon\fR, \fIprn\fR,\&\fIcom*\fR, \fIlpt?\fR, \fInul\fR) are invalid as base filenames. However, theycan be used in extensions (e.g., \fIhello.aux\fR). Names may contain allprintable characters except these:.Sp.Vb 1\& : * ? " < > |.Ve.SpFile names are case insensitive, but case preserving. A pathname thatcontains a backslash or drive letter is a Win32 pathname (and not subjectto the translations applied to \s-1POSIX\s0 style pathnames)..SpFor conversion we have \f(CW\*(C`Cygwin::win_to_posix_path()\*(C'\fR and\&\f(CW\*(C`Cygwin::posix_to_win_path()\*(C'\fR..SpPathnames may not contain Unicode characters. \f(CW\*(C`Cygwin\*(C'\fR still uses the\&\s-1ANSI\s0 \s-1API\s0 calls and no Unicode calls because of newlib deficiencies.There's an unofficial unicode patch for cygwin at\&\fIhttp://www.okisoft.co.jp/esc/utf8\-cygwin/\fR.IP "\(bu" 4Text/Binary.SpWhen a file is opened it is in either text or binary mode. In text modea file is subject to CR/LF/Ctrl\-Z translations. With Cygwin, the defaultmode for an \f(CW\*(C`open()\*(C'\fR is determined by the mode of the mount that underliesthe file. See \f(CW\*(C`Cygwin::is_binmount()\*(C'\fR. Perl provides a \f(CW\*(C`binmode()\*(C'\fR functionto set binary mode on files that otherwise would be treated as text.\&\f(CW\*(C`sysopen()\*(C'\fR with the \f(CW\*(C`O_TEXT\*(C'\fR flag sets text mode on files that otherwisewould be treated as binary:.Sp.Vb 1\& sysopen(FOO, "bar", O_WRONLY|O_CREAT|O_TEXT).Ve.Sp\&\f(CW\*(C`lseek()\*(C'\fR, \f(CW\*(C`tell()\*(C'\fR and \f(CW\*(C`sysseek()\*(C'\fR only work with files opened in binarymode..SpThe text/binary issue is covered at length in the Cygwin documentation..IP "\(bu" 4PerlIO.SpPerlIO overrides the default Cygwin Text/Binary behaviour. A file willalways be treated as binary, regardless of the mode of the mount it liveson, just like it is in \s-1UNIX\s0. So \s-1CR/LF\s0 translation needs to be requested ineither the \f(CW\*(C`open()\*(C'\fR call like this:.Sp.Vb 1\& open(FH, ">:crlf", "out.txt");.Ve.Spwhich will do conversion from \s-1LF\s0 to \s-1CR/LF\s0 on the output, or in theenvironment settings (add this to your .bashrc):.Sp.Vb 1\& export PERLIO=crlf.Ve.Spwhich will pull in the crlf PerlIO layer which does \s-1LF\s0 \-> \s-1CRLF\s0 conversionon every output generated by perl..IP "\(bu" 4\&\fI.exe\fR.SpThe Cygwin \f(CW\*(C`stat()\*(C'\fR, \f(CW\*(C`lstat()\*(C'\fR and \f(CW\*(C`readlink()\*(C'\fR functions make the \fI.exe\fRextension transparent by looking for \fIfoo.exe\fR when you ask for \fIfoo\fR(unless a \fIfoo\fR also exists). Cygwin does not require a \fI.exe\fRextension, but \fIgcc\fR adds it automatically when building a program.However, when accessing an executable as a normal file (e.g., \fIcp\fRin a makefile) the \fI.exe\fR is not transparent. The \fIinstall\fR includedwith Cygwin automatically appends a \fI.exe\fR when necessary..IP "\(bu" 4Cygwin vs. Windows process ids.SpCygwin processes have their own pid, which is different from theunderlying windows pid. Most posix compliant Proc functions expectthe cygwin pid, but several Win32::Process functions expect thewinpid. E.g. \f(CW$$\fR is the cygwin pid of \fI/usr/bin/perl\fR, which is notthe winpid. Use \f(CW\*(C`Cygwin::winpid_to_pid()\*(C'\fR and \f(CW\*(C`Cygwin::winpid_to_pid()\*(C'\fRto translate between them..IP "\(bu" 4Cygwin vs. Windows errors.SpUnder Cygwin, $^E is the same as $!. When using Win32 \s-1API\s0 Functions,use \f(CW\*(C`Win32::GetLastError()\*(C'\fR to get the last Windows error..IP "\(bu" 4\&\f(CW\*(C`chown()\*(C'\fR.SpOn WinNT \f(CW\*(C`chown()\*(C'\fR can change a file's user and group IDs. On Win9x \f(CW\*(C`chown()\*(C'\fRis a no-op, although this is appropriate since there is no security model..IP "\(bu" 4Miscellaneous.SpFile locking using the \f(CW\*(C`F_GETLK\*(C'\fR command to \f(CW\*(C`fcntl()\*(C'\fR is a stub thatreturns \f(CW\*(C`ENOSYS\*(C'\fR..SpWin9x can not \f(CW\*(C`rename()\*(C'\fR an open file (although WinNT can)..SpThe Cygwin \f(CW\*(C`chroot()\*(C'\fR implementation has holes (it can not restrict fileaccess by native Win32 programs)..SpInplace editing \f(CW\*(C`perl \-i\*(C'\fR of files doesn't work without doing a backupof the file being edited \f(CW\*(C`perl \-i.bak\*(C'\fR because of windowish restrictions,therefore Perl adds the suffix \f(CW\*(C`.bak\*(C'\fR automatically if you use \f(CW\*(C`perl \-i\*(C'\fRwithout specifying a backup extension..SpUsing \f(CW\*(C`fork()\*(C'\fR after loading multiple dlls may fail with an internal cygwinerror like the following:.Sp.Vb 1\& C:\eCYGWIN\eBIN\ePERL.EXE: *** couldn\*(Aqt allocate memory 0x10000(4128768) for \*(AqC:\eCYGWIN\eLIB\ePERL5\e5.6.1\eCYGWIN\-MULTI\eAUTO\eSOCKET\eSOCKET.DLL\*(Aq alignment, Win32 error 8\&\& 200 [main] perl 377147 sync_with_child: child \-395691(0xB8) died before initialization with status code 0x1\& 1370 [main] perl 377147 sync_with_child: *** child state child loading dlls.Ve.SpUse the rebase utility to resolve the conflicting dll addresses. Therebase package is included in the Cygwin netrelease. Use setup.exe from\&\fIhttp://www.cygwin.com/setup.exe\fR to install it and run rebaseall..Sh "Prebuilt methods:".IX Subsection "Prebuilt methods:".ie n .IP """Cwd::cwd""" 4.el .IP "\f(CWCwd::cwd\fR" 4.IX Item "Cwd::cwd"Returns the current working directory..ie n .IP """Cygwin::pid_to_winpid""" 4.el .IP "\f(CWCygwin::pid_to_winpid\fR" 4.IX Item "Cygwin::pid_to_winpid"Translates a cygwin pid to the corresponding Windows pid (which may ormay not be the same)..ie n .IP """Cygwin::winpid_to_pid""" 4.el .IP "\f(CWCygwin::winpid_to_pid\fR" 4.IX Item "Cygwin::winpid_to_pid"Translates a Windows pid to the corresponding cygwin pid (if any)..ie n .IP """Cygwin::win_to_posix_path""" 4.el .IP "\f(CWCygwin::win_to_posix_path\fR" 4.IX Item "Cygwin::win_to_posix_path"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -