1PERLWIN32(1) Perl Programmers Reference Guide PERLWIN32(1)
2
3
4
6 perlwin32 - Perl under Windows
7
9 These are instructions for building Perl under Windows 2000 and later.
10
12 Before you start, you should glance through the README file found in
13 the top-level directory to which the Perl distribution was extracted.
14 Make sure you read and understand the terms under which this software
15 is being distributed.
16
17 Also make sure you read "BUGS AND CAVEATS" below for the known
18 limitations of this port.
19
20 The INSTALL file in the perl top-level has much information that is
21 only relevant to people building Perl on Unix-like systems. In
22 particular, you can safely ignore any information that talks about
23 "Configure".
24
25 You may also want to look at one other option for building a perl that
26 will work on Windows: the README.cygwin file, which give a different
27 set of rules to build a perl for Windows. This method will probably
28 enable you to build a more Unix-compatible perl, but you will also need
29 to download and use various other build-time and run-time support
30 software described in that file.
31
32 This set of instructions is meant to describe a so-called "native" port
33 of Perl to the Windows platform. This includes both 32-bit and 64-bit
34 Windows operating systems. The resulting Perl requires no additional
35 software to run (other than what came with your operating system).
36 Currently, this port is capable of using one of the following compilers
37 on the Intel x86 architecture:
38
39 Microsoft Visual C++ version 6.0 or later
40 Gcc by mingw.org gcc version 3.2 or later
41 Gcc by mingw-w64.sf.net gcc version 4.4.3 or later
42
43 Note that the last two of these are actually competing projects both
44 delivering complete gcc toolchain for MS Windows:
45
46 <http://mingw.org>
47 Delivers gcc toolchain targeting 32-bit Windows platform.
48
49 http://mingw-w64.sf.net <http://mingw-w64.sf.net>
50 Delivers gcc toolchain targeting both 64-bit Windows and 32-bit
51 Windows platforms (despite the project name "mingw-w64" they are
52 not only 64-bit oriented). They deliver the native gcc compilers
53 and cross-compilers that are also supported by perl's makefile.
54
55 The Microsoft Visual C++ compilers are also now being given away free.
56 They are available as "Visual C++ Toolkit 2003" or "Visual C++
57 2005/2008/2010 Express Edition" (and also as part of the ".NET
58 Framework SDK") and are the same compilers that ship with "Visual C++
59 .NET 2003 Professional" or "Visual C++ 2005/2008/2010 Professional"
60 respectively.
61
62 This port can also be built on IA64/AMD64 using:
63
64 Microsoft Platform SDK Nov 2001 (64-bit compiler and tools)
65 MinGW64 compiler (gcc version 4.4.3 or later)
66
67 The Windows SDK can be downloaded from <http://www.microsoft.com/>.
68 The MinGW64 compiler is available at
69 http://sourceforge.net/projects/mingw-w64
70 <http://sourceforge.net/projects/mingw-w64>. The latter is actually a
71 cross-compiler targeting Win64. There's also a trimmed down compiler
72 (no java, or gfortran) suitable for building perl available at:
73 <http://strawberryperl.com/package/kmx/64_gcctoolchain/>
74
75 NOTE: If you're using a 32-bit compiler to build perl on a 64-bit
76 Windows operating system, then you should set the WIN64 environment
77 variable to "undef". Also, the trimmed down compiler only passes tests
78 when USE_ITHREADS *= define (as opposed to undef) and when the CFG *=
79 Debug line is commented out.
80
81 This port fully supports MakeMaker (the set of modules that is used to
82 build extensions to perl). Therefore, you should be able to build and
83 install most extensions found in the CPAN sites. See "Usage Hints for
84 Perl on Windows" below for general hints about this.
85
86 Setting Up Perl on Windows
87 Make
88 You need a "make" program to build the sources. If you are using
89 Visual C++ or the Windows SDK tools, nmake will work. Builds using
90 the gcc need dmake.
91
92 dmake is a freely available make that has very nice macro features
93 and parallelability.
94
95 A port of dmake for Windows is available from:
96
97 <http://search.cpan.org/dist/dmake/>
98
99 Fetch and install dmake somewhere on your path.
100
101 Command Shell
102 Use the default "cmd" shell that comes with Windows. Some versions
103 of the popular 4DOS/NT shell have incompatibilities that may cause
104 you trouble. If the build fails under that shell, try building
105 again with the cmd shell.
106
107 Make sure the path to the build directory does not contain spaces.
108 The build usually works in this circumstance, but some tests will
109 fail.
110
111 Microsoft Visual C++
112 The nmake that comes with Visual C++ will suffice for building.
113 You will need to run the VCVARS32.BAT file, usually found somewhere
114 like C:\Program Files\Microsoft Visual Studio\VC98\Bin. This will
115 set your build environment.
116
117 You can also use dmake to build using Visual C++; provided,
118 however, you set OSRELEASE to "microsft" (or whatever the directory
119 name under which the Visual C dmake configuration lives) in your
120 environment and edit win32/config.vc to change "make=nmake" into
121 "make=dmake". The latter step is only essential if you want to use
122 dmake as your default make for building extensions using MakeMaker.
123
124 Microsoft Visual C++ 2008/2010 Express Edition
125 These free versions of Visual C++ 2008/2010 Professional contain
126 the same compilers and linkers that ship with the full versions,
127 and also contain everything necessary to build Perl, rather than
128 requiring a separate download of the Windows SDK like previous
129 versions did.
130
131 These packages can be downloaded by searching in the Download
132 Center at
133 <http://www.microsoft.com/downloads/search.aspx?displaylang=en>.
134 (Providing exact links to these packages has proven a pointless
135 task because the links keep on changing so often.)
136
137 Install Visual C++ 2008/2010 Express, then setup your environment
138 using, e.g.
139
140 C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat
141
142 (assuming the default installation location was chosen).
143
144 Perl should now build using the win32/Makefile. You will need to
145 edit that file to set CCTYPE to MSVC90FREE or MSVC100FREE first.
146
147 Microsoft Visual C++ 2005 Express Edition
148 This free version of Visual C++ 2005 Professional contains the same
149 compiler and linker that ship with the full version, but doesn't
150 contain everything necessary to build Perl.
151
152 You will also need to download the "Windows SDK" (the "Core SDK"
153 and "MDAC SDK" components are required) for more header files and
154 libraries.
155
156 These packages can both be downloaded by searching in the Download
157 Center at
158 <http://www.microsoft.com/downloads/search.aspx?displaylang=en>.
159 (Providing exact links to these packages has proven a pointless
160 task because the links keep on changing so often.)
161
162 Try to obtain the latest version of the Windows SDK. Sometimes
163 these packages contain a particular Windows OS version in their
164 name, but actually work on other OS versions too. For example, the
165 "Windows Server 2003 R2 Platform SDK" also runs on Windows XP SP2
166 and Windows 2000.
167
168 Install Visual C++ 2005 first, then the Platform SDK. Setup your
169 environment as follows (assuming default installation locations
170 were chosen):
171
172 SET PlatformSDKDir=C:\Program Files\Microsoft Platform SDK
173
174 SET PATH=%SystemRoot%\system32;%SystemRoot%;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PlatformSDKDir%\Bin
175
176 SET INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;%PlatformSDKDir%\include
177
178 SET LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%PlatformSDKDir%\lib
179
180 SET LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
181
182 (The PlatformSDKDir might need to be set differently depending on
183 which version you are using. Earlier versions installed into
184 "C:\Program Files\Microsoft SDK", while the latest versions install
185 into version-specific locations such as "C:\Program Files\Microsoft
186 Platform SDK for Windows Server 2003 R2".)
187
188 Perl should now build using the win32/Makefile. You will need to
189 edit that file to set
190
191 CCTYPE = MSVC80FREE
192
193 and to set CCHOME, CCINCDIR and CCLIBDIR as per the environment
194 setup above.
195
196 Microsoft Visual C++ Toolkit 2003
197 This free toolkit contains the same compiler and linker that ship
198 with Visual C++ .NET 2003 Professional, but doesn't contain
199 everything necessary to build Perl.
200
201 You will also need to download the "Platform SDK" (the "Core SDK"
202 and "MDAC SDK" components are required) for header files, libraries
203 and rc.exe, and ".NET Framework SDK" for more libraries and
204 nmake.exe. Note that the latter (which also includes the free
205 compiler and linker) requires the ".NET Framework Redistributable"
206 to be installed first. This can be downloaded and installed
207 separately, but is included in the "Visual C++ Toolkit 2003"
208 anyway.
209
210 These packages can all be downloaded by searching in the Download
211 Center at
212 <http://www.microsoft.com/downloads/search.aspx?displaylang=en>.
213 (Providing exact links to these packages has proven a pointless
214 task because the links keep on changing so often.)
215
216 Try to obtain the latest version of the Windows SDK. Sometimes
217 these packages contain a particular Windows OS version in their
218 name, but actually work on other OS versions too. For example, the
219 "Windows Server 2003 R2 Platform SDK" also runs on Windows XP SP2
220 and Windows 2000.
221
222 Install the Toolkit first, then the Platform SDK, then the .NET
223 Framework SDK. Setup your environment as follows (assuming default
224 installation locations were chosen):
225
226 SET PlatformSDKDir=C:\Program Files\Microsoft Platform SDK
227
228 SET PATH=%SystemRoot%\system32;%SystemRoot%;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;%PlatformSDKDir%\Bin;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin
229
230 SET INCLUDE=C:\Program Files\Microsoft Visual C++ Toolkit 2003\include;%PlatformSDKDir%\include;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
231
232 SET LIB=C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;%PlatformSDKDir%\lib;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
233
234 (The PlatformSDKDir might need to be set differently depending on
235 which version you are using. Earlier versions installed into
236 "C:\Program Files\Microsoft SDK", while the latest versions install
237 into version-specific locations such as "C:\Program Files\Microsoft
238 Platform SDK for Windows Server 2003 R2".)
239
240 Several required files will still be missing:
241
242 · cvtres.exe is required by link.exe when using a .res file. It
243 is actually installed by the .NET Framework SDK, but into a
244 location such as the following:
245
246 C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
247
248 Copy it from there to %PlatformSDKDir%\Bin
249
250 · lib.exe is normally used to build libraries, but link.exe with
251 the /lib option also works, so change win32/config.vc to use it
252 instead:
253
254 Change the line reading:
255
256 ar='lib'
257
258 to:
259
260 ar='link /lib'
261
262 It may also be useful to create a batch file called lib.bat in
263 C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin
264 containing:
265
266 @echo off
267 link /lib %*
268
269 for the benefit of any naughty C extension modules that you
270 might want to build later which explicitly reference "lib"
271 rather than taking their value from $Config{ar}.
272
273 · setargv.obj is required to build perlglob.exe (and perl.exe if
274 the USE_SETARGV option is enabled). The Platform SDK supplies
275 this object file in source form in %PlatformSDKDir%\src\crt.
276 Copy setargv.c, cruntime.h and internal.h from there to some
277 temporary location and build setargv.obj using
278
279 cl.exe /c /I. /D_CRTBLD setargv.c
280
281 Then copy setargv.obj to %PlatformSDKDir%\lib
282
283 Alternatively, if you don't need perlglob.exe and don't need to
284 enable the USE_SETARGV option then you can safely just remove
285 all mention of $(GLOBEXE) from win32/Makefile and setargv.obj
286 won't be required anyway.
287
288 Perl should now build using the win32/Makefile. You will need to
289 edit that file to set
290
291 CCTYPE = MSVC70FREE
292
293 and to set CCHOME, CCINCDIR and CCLIBDIR as per the environment
294 setup above.
295
296 Microsoft Platform SDK 64-bit Compiler
297 The nmake that comes with the Platform SDK will suffice for
298 building Perl. Make sure you are building within one of the "Build
299 Environment" shells available after you install the Platform SDK
300 from the Start Menu.
301
302 MinGW release 3 with gcc
303 Perl can be compiled with gcc from MinGW release 3 and later (using
304 gcc 3.2.x and later). It can be downloaded here:
305
306 <http://www.mingw.org/>
307
308 You also need dmake. See "Make" above on how to get it.
309
310 Building
311 · Make sure you are in the "win32" subdirectory under the perl
312 toplevel. This directory contains a "Makefile" that will work with
313 versions of nmake that come with Visual C++ or the Windows SDK, and
314 a dmake "makefile.mk" that will work for all supported compilers.
315 The defaults in the dmake makefile are setup to build using
316 MinGW/gcc.
317
318 · Edit the makefile.mk (or Makefile, if you're using nmake) and
319 change the values of INST_DRV and INST_TOP. You can also enable
320 various build flags. These are explained in the makefiles.
321
322 Note that it is generally not a good idea to try to build a perl
323 with INST_DRV and INST_TOP set to a path that already exists from a
324 previous build. In particular, this may cause problems with the
325 lib/ExtUtils/t/Embed.t test, which attempts to build a test program
326 and may end up building against the installed perl's lib/CORE
327 directory rather than the one being tested.
328
329 You will have to make sure that CCTYPE is set correctly and that
330 CCHOME points to wherever you installed your compiler.
331
332 If building with the cross-compiler provided by
333 mingw-w64.sourceforge.net you'll need to uncomment the line that
334 sets GCCCROSS in the makefile.mk. Do this only if it's the cross-
335 compiler - ie only if the bin folder doesn't contain a gcc.exe.
336 (The cross-compiler does not provide a gcc.exe, g++.exe, ar.exe,
337 etc. Instead, all of these executables are prefixed with
338 'x86_64-w64-mingw32-'.)
339
340 The default value for CCHOME in the makefiles for Visual C++ may
341 not be correct for some versions. Make sure the default exists and
342 is valid.
343
344 You may also need to comment out the "DELAYLOAD = ..." line in the
345 Makefile if you're using VC++ 6.0 without the latest service pack
346 and the linker reports an internal error.
347
348 If you want build some core extensions statically into perl's dll,
349 specify them in the STATIC_EXT macro.
350
351 Be sure to read the instructions near the top of the makefiles
352 carefully.
353
354 · Type "dmake" (or "nmake" if you are using that make).
355
356 This should build everything. Specifically, it will create
357 perl.exe, perl516.dll at the perl toplevel, and various other
358 extension dll's under the lib\auto directory. If the build fails
359 for any reason, make sure you have done the previous steps
360 correctly.
361
362 Testing Perl on Windows
363 Type "dmake test" (or "nmake test"). This will run most of the tests
364 from the testsuite (many tests will be skipped).
365
366 There should be no test failures.
367
368 Some test failures may occur if you use a command shell other than the
369 native "cmd.exe", or if you are building from a path that contains
370 spaces. So don't do that.
371
372 If you are running the tests from a emacs shell window, you may see
373 failures in op/stat.t. Run "dmake test-notty" in that case.
374
375 If you run the tests on a FAT partition, you may see some failures for
376 "link()" related tests (op/write.t, op/stat.t ...). Testing on NTFS
377 avoids these errors.
378
379 Furthermore, you should make sure that during "make test" you do not
380 have any GNU tool packages in your path: some toolkits like Unixutils
381 include some tools ("type" for instance) which override the Windows
382 ones and makes tests fail. Remove them from your path while testing to
383 avoid these errors.
384
385 Please report any other failures as described under "BUGS AND CAVEATS".
386
387 Installation of Perl on Windows
388 Type "dmake install" (or "nmake install"). This will put the newly
389 built perl and the libraries under whatever "INST_TOP" points to in the
390 Makefile. It will also install the pod documentation under
391 "$INST_TOP\$INST_VER\lib\pod" and HTML versions of the same under
392 "$INST_TOP\$INST_VER\lib\pod\html".
393
394 To use the Perl you just installed you will need to add a new entry to
395 your PATH environment variable: "$INST_TOP\bin", e.g.
396
397 set PATH=c:\perl\bin;%PATH%
398
399 If you opted to uncomment "INST_VER" and "INST_ARCH" in the makefile
400 then the installation structure is a little more complicated and you
401 will need to add two new PATH components instead:
402 "$INST_TOP\$INST_VER\bin" and "$INST_TOP\$INST_VER\bin\$ARCHNAME", e.g.
403
404 set PATH=c:\perl\5.6.0\bin;c:\perl\5.6.0\bin\MSWin32-x86;%PATH%
405
406 Usage Hints for Perl on Windows
407 Environment Variables
408 The installation paths that you set during the build get compiled
409 into perl, so you don't have to do anything additional to start
410 using that perl (except add its location to your PATH variable).
411
412 If you put extensions in unusual places, you can set PERL5LIB to a
413 list of paths separated by semicolons where you want perl to look
414 for libraries. Look for descriptions of other environment
415 variables you can set in perlrun.
416
417 You can also control the shell that perl uses to run system() and
418 backtick commands via PERL5SHELL. See perlrun.
419
420 Perl does not depend on the registry, but it can look up certain
421 default values if you choose to put them there. Perl attempts to
422 read entries from "HKEY_CURRENT_USER\Software\Perl" and
423 "HKEY_LOCAL_MACHINE\Software\Perl". Entries in the former override
424 entries in the latter. One or more of the following entries (of
425 type REG_SZ or REG_EXPAND_SZ) may be set:
426
427 lib-$] version-specific standard library path to add to @INC
428 lib standard library path to add to @INC
429 sitelib-$] version-specific site library path to add to @INC
430 sitelib site library path to add to @INC
431 vendorlib-$] version-specific vendor library path to add to @INC
432 vendorlib vendor library path to add to @INC
433 PERL* fallback for all %ENV lookups that begin with "PERL"
434
435 Note the $] in the above is not literal. Substitute whatever
436 version of perl you want to honor that entry, e.g. 5.6.0. Paths
437 must be separated with semicolons, as usual on Windows.
438
439 File Globbing
440 By default, perl handles file globbing using the File::Glob
441 extension, which provides portable globbing.
442
443 If you want perl to use globbing that emulates the quirks of DOS
444 filename conventions, you might want to consider using
445 File::DosGlob to override the internal glob() implementation. See
446 File::DosGlob for details.
447
448 Using perl from the command line
449 If you are accustomed to using perl from various command-line
450 shells found in UNIX environments, you will be less than pleased
451 with what Windows offers by way of a command shell.
452
453 The crucial thing to understand about the Windows environment is
454 that the command line you type in is processed twice before Perl
455 sees it. First, your command shell (usually CMD.EXE) preprocesses
456 the command line, to handle redirection, environment variable
457 expansion, and location of the executable to run. Then, the perl
458 executable splits the remaining command line into individual
459 arguments, using the C runtime library upon which Perl was built.
460
461 It is particularly important to note that neither the shell nor the
462 C runtime do any wildcard expansions of command-line arguments (so
463 wildcards need not be quoted). Also, the quoting behaviours of the
464 shell and the C runtime are rudimentary at best (and may, if you
465 are using a non-standard shell, be inconsistent). The only
466 (useful) quote character is the double quote ("). It can be used
467 to protect spaces and other special characters in arguments.
468
469 The Windows documentation describes the shell parsing rules here:
470 http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true
471 <http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-
472 us/cmd.mspx?mfr=true> and the C runtime parsing rules here:
473 http://msdn.microsoft.com/en-us/library/17w5ykft%28v=VS.100%29.aspx
474 <http://msdn.microsoft.com/en-
475 us/library/17w5ykft%28v=VS.100%29.aspx>.
476
477 Here are some further observations based on experiments: The C
478 runtime breaks arguments at spaces and passes them to programs in
479 argc/argv. Double quotes can be used to prevent arguments with
480 spaces in them from being split up. You can put a double quote in
481 an argument by escaping it with a backslash and enclosing the whole
482 argument within double quotes. The backslash and the pair of
483 double quotes surrounding the argument will be stripped by the C
484 runtime.
485
486 The file redirection characters "<", ">", and "|" can be quoted by
487 double quotes (although there are suggestions that this may not
488 always be true). Single quotes are not treated as quotes by the
489 shell or the C runtime, they don't get stripped by the shell (just
490 to make this type of quoting completely useless). The caret "^"
491 has also been observed to behave as a quoting character, but this
492 appears to be a shell feature, and the caret is not stripped from
493 the command line, so Perl still sees it (and the C runtime phase
494 does not treat the caret as a quote character).
495
496 Here are some examples of usage of the "cmd" shell:
497
498 This prints two doublequotes:
499
500 perl -e "print '\"\"' "
501
502 This does the same:
503
504 perl -e "print \"\\\"\\\"\" "
505
506 This prints "bar" and writes "foo" to the file "blurch":
507
508 perl -e "print 'foo'; print STDERR 'bar'" > blurch
509
510 This prints "foo" ("bar" disappears into nowhereland):
511
512 perl -e "print 'foo'; print STDERR 'bar'" 2> nul
513
514 This prints "bar" and writes "foo" into the file "blurch":
515
516 perl -e "print 'foo'; print STDERR 'bar'" 1> blurch
517
518 This pipes "foo" to the "less" pager and prints "bar" on the
519 console:
520
521 perl -e "print 'foo'; print STDERR 'bar'" | less
522
523 This pipes "foo\nbar\n" to the less pager:
524
525 perl -le "print 'foo'; print STDERR 'bar'" 2>&1 | less
526
527 This pipes "foo" to the pager and writes "bar" in the file
528 "blurch":
529
530 perl -e "print 'foo'; print STDERR 'bar'" 2> blurch | less
531
532 Discovering the usefulness of the "command.com" shell on Windows 9x
533 is left as an exercise to the reader :)
534
535 One particularly pernicious problem with the 4NT command shell for
536 Windows is that it (nearly) always treats a % character as
537 indicating that environment variable expansion is needed. Under
538 this shell, it is therefore important to always double any %
539 characters which you want Perl to see (for example, for hash
540 variables), even when they are quoted.
541
542 Building Extensions
543 The Comprehensive Perl Archive Network (CPAN) offers a wealth of
544 extensions, some of which require a C compiler to build. Look in
545 <http://www.cpan.org/> for more information on CPAN.
546
547 Note that not all of the extensions available from CPAN may work in
548 the Windows environment; you should check the information at
549 <http://testers.cpan.org/> before investing too much effort into
550 porting modules that don't readily build.
551
552 Most extensions (whether they require a C compiler or not) can be
553 built, tested and installed with the standard mantra:
554
555 perl Makefile.PL
556 $MAKE
557 $MAKE test
558 $MAKE install
559
560 where $MAKE is whatever 'make' program you have configured perl to
561 use. Use "perl -V:make" to find out what this is. Some extensions
562 may not provide a testsuite (so "$MAKE test" may not do anything or
563 fail), but most serious ones do.
564
565 It is important that you use a supported 'make' program, and ensure
566 Config.pm knows about it. If you don't have nmake, you can either
567 get dmake from the location mentioned earlier or get an old version
568 of nmake reportedly available from:
569
570 http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe
571 <http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-
572 US/nmake15.exe>
573
574 Another option is to use the make written in Perl, available from
575 CPAN.
576
577 http://www.cpan.org/modules/by-module/Make/
578 <http://www.cpan.org/modules/by-module/Make/>
579
580 You may also use dmake. See "Make" above on how to get it.
581
582 Note that MakeMaker actually emits makefiles with different syntax
583 depending on what 'make' it thinks you are using. Therefore, it is
584 important that one of the following values appears in Config.pm:
585
586 make='nmake' # MakeMaker emits nmake syntax
587 make='dmake' # MakeMaker emits dmake syntax
588 any other value # MakeMaker emits generic make syntax
589 (e.g GNU make, or Perl make)
590
591 If the value doesn't match the 'make' program you want to use, edit
592 Config.pm to fix it.
593
594 If a module implements XSUBs, you will need one of the supported C
595 compilers. You must make sure you have set up the environment for
596 the compiler for command-line compilation.
597
598 If a module does not build for some reason, look carefully for why
599 it failed, and report problems to the module author. If it looks
600 like the extension building support is at fault, report that with
601 full details of how the build failed using the perlbug utility.
602
603 Command-line Wildcard Expansion
604 The default command shells on DOS descendant operating systems
605 (such as they are) usually do not expand wildcard arguments
606 supplied to programs. They consider it the application's job to
607 handle that. This is commonly achieved by linking the application
608 (in our case, perl) with startup code that the C runtime libraries
609 usually provide. However, doing that results in incompatible perl
610 versions (since the behavior of the argv expansion code differs
611 depending on the compiler, and it is even buggy on some compilers).
612 Besides, it may be a source of frustration if you use such a perl
613 binary with an alternate shell that *does* expand wildcards.
614
615 Instead, the following solution works rather well. The nice things
616 about it are 1) you can start using it right away; 2) it is more
617 powerful, because it will do the right thing with a pattern like
618 */*/*.c; 3) you can decide whether you do/don't want to use it; and
619 4) you can extend the method to add any customizations (or even
620 entirely different kinds of wildcard expansion).
621
622 C:\> copy con c:\perl\lib\Wild.pm
623 # Wild.pm - emulate shell @ARGV expansion on shells that don't
624 use File::DosGlob;
625 @ARGV = map {
626 my @g = File::DosGlob::glob($_) if /[*?]/;
627 @g ? @g : $_;
628 } @ARGV;
629 1;
630 ^Z
631 C:\> set PERL5OPT=-MWild
632 C:\> perl -le "for (@ARGV) { print }" */*/perl*.c
633 p4view/perl/perl.c
634 p4view/perl/perlio.c
635 p4view/perl/perly.c
636 perl5.005/win32/perlglob.c
637 perl5.005/win32/perllib.c
638 perl5.005/win32/perlglob.c
639 perl5.005/win32/perllib.c
640 perl5.005/win32/perlglob.c
641 perl5.005/win32/perllib.c
642
643 Note there are two distinct steps there: 1) You'll have to create
644 Wild.pm and put it in your perl lib directory. 2) You'll need to
645 set the PERL5OPT environment variable. If you want argv expansion
646 to be the default, just set PERL5OPT in your default startup
647 environment.
648
649 If you are using the Visual C compiler, you can get the C runtime's
650 command line wildcard expansion built into perl binary. The
651 resulting binary will always expand unquoted command lines, which
652 may not be what you want if you use a shell that does that for you.
653 The expansion done is also somewhat less powerful than the approach
654 suggested above.
655
656 Notes on 64-bit Windows
657 Windows .NET Server supports the LLP64 data model on the Intel
658 Itanium architecture.
659
660 The LLP64 data model is different from the LP64 data model that is
661 the norm on 64-bit Unix platforms. In the former, "int" and "long"
662 are both 32-bit data types, while pointers are 64 bits wide. In
663 addition, there is a separate 64-bit wide integral type, "__int64".
664 In contrast, the LP64 data model that is pervasive on Unix
665 platforms provides "int" as the 32-bit type, while both the "long"
666 type and pointers are of 64-bit precision. Note that both models
667 provide for 64-bits of addressability.
668
669 64-bit Windows running on Itanium is capable of running 32-bit x86
670 binaries transparently. This means that you could use a 32-bit
671 build of Perl on a 64-bit system. Given this, why would one want
672 to build a 64-bit build of Perl? Here are some reasons why you
673 would bother:
674
675 · A 64-bit native application will run much more efficiently on
676 Itanium hardware.
677
678 · There is no 2GB limit on process size.
679
680 · Perl automatically provides large file support when built under
681 64-bit Windows.
682
683 · Embedding Perl inside a 64-bit application.
684
685 Running Perl Scripts
686 Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to indicate to
687 the OS that it should execute the file using perl. Windows has no
688 comparable means to indicate arbitrary files are executables.
689
690 Instead, all available methods to execute plain text files on Windows
691 rely on the file "extension". There are three methods to use this to
692 execute perl scripts:
693
694 1. There is a facility called "file extension associations". This
695 can be manipulated via the two commands "assoc" and "ftype"
696 that come standard with Windows. Type "ftype /?" for a
697 complete example of how to set this up for perl scripts (Say
698 what? You thought Windows wasn't perl-ready? :).
699
700 2. Since file associations don't work everywhere, and there are
701 reportedly bugs with file associations where it does work, the
702 old method of wrapping the perl script to make it look like a
703 regular batch file to the OS, may be used. The install process
704 makes available the "pl2bat.bat" script which can be used to
705 wrap perl scripts into batch files. For example:
706
707 pl2bat foo.pl
708
709 will create the file "FOO.BAT". Note "pl2bat" strips any .pl
710 suffix and adds a .bat suffix to the generated file.
711
712 If you use the 4DOS/NT or similar command shell, note that
713 "pl2bat" uses the "%*" variable in the generated batch file to
714 refer to all the command line arguments, so you may need to
715 make sure that construct works in batch files. As of this
716 writing, 4DOS/NT users will need a "ParameterChar = *"
717 statement in their 4NT.INI file or will need to execute "setdos
718 /p*" in the 4DOS/NT startup file to enable this to work.
719
720 3. Using "pl2bat" has a few problems: the file name gets changed,
721 so scripts that rely on $0 to find what they must do may not
722 run properly; running "pl2bat" replicates the contents of the
723 original script, and so this process can be maintenance
724 intensive if the originals get updated often. A different
725 approach that avoids both problems is possible.
726
727 A script called "runperl.bat" is available that can be copied
728 to any filename (along with the .bat suffix). For example, if
729 you call it "foo.bat", it will run the file "foo" when it is
730 executed. Since you can run batch files on Windows platforms
731 simply by typing the name (without the extension), this
732 effectively runs the file "foo", when you type either "foo" or
733 "foo.bat". With this method, "foo.bat" can even be in a
734 different location than the file "foo", as long as "foo" is
735 available somewhere on the PATH. If your scripts are on a
736 filesystem that allows symbolic links, you can even avoid
737 copying "runperl.bat".
738
739 Here's a diversion: copy "runperl.bat" to "runperl", and type
740 "runperl". Explain the observed behavior, or lack thereof. :)
741 Hint: .gnidnats llits er'uoy fi ,"lrepnur" eteled :tniH
742
743 Miscellaneous Things
744 A full set of HTML documentation is installed, so you should be able to
745 use it if you have a web browser installed on your system.
746
747 "perldoc" is also a useful tool for browsing information contained in
748 the documentation, especially in conjunction with a pager like "less"
749 (recent versions of which have Windows support). You may have to set
750 the PAGER environment variable to use a specific pager. "perldoc -f
751 foo" will print information about the perl operator "foo".
752
753 One common mistake when using this port with a GUI library like "Tk" is
754 assuming that Perl's normal behavior of opening a command-line window
755 will go away. This isn't the case. If you want to start a copy of
756 "perl" without opening a command-line window, use the "wperl"
757 executable built during the installation process. Usage is exactly the
758 same as normal "perl" on Windows, except that options like "-h" don't
759 work (since they need a command-line window to print to).
760
761 If you find bugs in perl, you can run "perlbug" to create a bug report
762 (you may have to send it manually if "perlbug" cannot find a mailer on
763 your system).
764
766 Norton AntiVirus interferes with the build process, particularly if set
767 to "AutoProtect, All Files, when Opened". Unlike large applications the
768 perl build process opens and modifies a lot of files. Having the the
769 AntiVirus scan each and every one slows build the process
770 significantly. Worse, with PERLIO=stdio the build process fails with
771 peculiar messages as the virus checker interacts badly with
772 miniperl.exe writing configure files (it seems to either catch file
773 part written and treat it as suspicious, or virus checker may have it
774 "locked" in a way which inhibits miniperl updating it). The build does
775 complete with
776
777 set PERLIO=perlio
778
779 but that may be just luck. Other AntiVirus software may have similar
780 issues.
781
782 Some of the built-in functions do not act exactly as documented in
783 perlfunc, and a few are not implemented at all. To avoid surprises,
784 particularly if you have had prior exposure to Perl in other operating
785 environments or if you intend to write code that will be portable to
786 other environments, see perlport for a reasonably definitive list of
787 these differences.
788
789 Not all extensions available from CPAN may build or work properly in
790 the Windows environment. See "Building Extensions".
791
792 Most "socket()" related calls are supported, but they may not behave as
793 on Unix platforms. See perlport for the full list.
794
795 Signal handling may not behave as on Unix platforms (where it doesn't
796 exactly "behave", either :). For instance, calling "die()" or "exit()"
797 from signal handlers will cause an exception, since most
798 implementations of "signal()" on Windows are severely crippled. Thus,
799 signals may work only for simple things like setting a flag variable in
800 the handler. Using signals under this port should currently be
801 considered unsupported.
802
803 Please send detailed descriptions of any problems and solutions that
804 you may find to <perlbug@perl.org>, along with the output produced by
805 "perl -V".
806
808 The use of a camel with the topic of Perl is a trademark of O'Reilly
809 and Associates, Inc. Used with permission.
810
812 Gary Ng <71564.1743@CompuServe.COM>
813 Gurusamy Sarathy <gsar@activestate.com>
814 Nick Ing-Simmons <nick@ing-simmons.net>
815 Jan Dubois <jand@activestate.com>
816 Steve Hay <steve.m.hay@googlemail.com>
817
818 This document is maintained by Jan Dubois.
819
821 perl
822
824 This port was originally contributed by Gary Ng around 5.003_24, and
825 borrowed from the Hip Communications port that was available at the
826 time. Various people have made numerous and sundry hacks since then.
827
828 GCC/mingw32 support was added in 5.005 (Nick Ing-Simmons).
829
830 Support for PERL_OBJECT was added in 5.005 (ActiveState Tool Corp).
831
832 Support for fork() emulation was added in 5.6 (ActiveState Tool Corp).
833
834 Win9x support was added in 5.6 (Benjamin Stuhl).
835
836 Support for 64-bit Windows added in 5.8 (ActiveState Corp).
837
838 Last updated: 10 September 2011
839
840
841
842perl v5.16.3 2013-03-04 PERLWIN32(1)