perlwin32.html

来自「perl教程」· HTML 代码 · 共 1,020 行 · 第 1/4 页

HTML
1,020
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>perlwin32 - Perl under Windows</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>perlwin32 - Perl under Windows</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<ul>

		<li><a href="#setting_up_perl_on_win32">Setting Up Perl on Win32</a></li>
		<li><a href="#building">Building</a></li>
		<li><a href="#testing_perl_on_win32">Testing Perl on Win32</a></li>
		<li><a href="#installation_of_perl_on_win32">Installation of Perl on Win32</a></li>
		<li><a href="#usage_hints_for_perl_on_win32">Usage Hints for Perl on Win32</a></li>
		<li><a href="#running_perl_scripts">Running Perl Scripts</a></li>
		<li><a href="#miscellaneous_things">Miscellaneous Things</a></li>
	</ul>

	<li><a href="#bugs_and_caveats">BUGS AND CAVEATS</a></li>
	<li><a href="#acknowledgements">ACKNOWLEDGEMENTS</a></li>
	<li><a href="#authors">AUTHORS</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#history">HISTORY</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>perlwin32 - Perl under Windows</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p>These are instructions for building Perl under Windows 9x/NT/2000/XP
on the Intel x86 and Itanium architectures.</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Before you start, you should glance through the README file
found in the top-level directory to which the Perl distribution
was extracted.  Make sure you read and understand the terms under
which this software is being distributed.</p>
<p>Also make sure you read <a href="#bugs_and_caveats">BUGS AND CAVEATS</a> below for the
known limitations of this port.</p>
<p>The INSTALL file in the perl top-level has much information that is
only relevant to people building Perl on Unix-like systems.  In
particular, you can safely ignore any information that talks about
&quot;Configure&quot;.</p>
<p>You may also want to look at two other options for building
a perl that will work on Windows NT:  the README.cygwin and
README.os2 files, each of which give a different set of rules to
build a Perl that will work on Win32 platforms.  Those two methods
will probably enable you to build a more Unix-compatible perl, but
you will also need to download and use various other build-time and
run-time support software described in those files.</p>
<p>This set of instructions is meant to describe a so-called &quot;native&quot;
port of Perl to Win32 platforms.  This includes both 32-bit and
64-bit Windows operating systems.  The resulting Perl requires no
additional software to run (other than what came with your operating
system).  Currently, this port is capable of using one of the
following compilers on the Intel x86 architecture:</p>
<pre>
      Borland C++           version 5.02 or later
      Microsoft Visual C++  version 2.0 or later
      MinGW with gcc        gcc version 2.95.2 or later</pre>
<p>The last of these is a high quality freeware compiler.  Use version
3.2.x or later for the best results with this compiler.</p>
<p>The Borland C++ and Microsoft Visual C++ compilers are also now being given
away free.  The Borland compiler is available as &quot;Borland C++ Compiler Free
Command Line Tools&quot; and is the same compiler that ships with the full
&quot;Borland C++ Builder&quot; product.  The Microsoft compiler is available as
&quot;Visual C++ Toolkit 2003&quot;, and also as part of the &quot;.NET Framework SDK&quot;, and
is the same compiler that ships with &quot;Visual Studio .NET 2003 Professional&quot;.</p>
<p>This port can also be built on the Intel IA64 using:</p>
<pre>
      Microsoft Platform SDK    Nov 2001 (64-bit compiler and tools)</pre>
<p>The MS Platform SDK can be downloaded from <a href="http://www.microsoft.com/.">http://www.microsoft.com/.</a></p>
<p>This port fully supports MakeMaker (the set of modules that
is used to build extensions to perl).  Therefore, you should be
able to build and install most extensions found in the CPAN sites.
See <a href="#usage_hints_for_perl_on_win32">Usage Hints for Perl on Win32</a> below for general hints about this.</p>
<p>
</p>
<h2><a name="setting_up_perl_on_win32">Setting Up Perl on Win32</a></h2>
<dl>
<dt><strong><a name="item_make">Make</a></strong>

<dd>
<p>You need a &quot;make&quot; program to build the sources.  If you are using
Visual C++ or the Platform SDK tools under Windows NT/2000/XP, nmake
will work.  All other builds need dmake.</p>
</dd>
<dd>
<p>dmake is a freely available make that has very nice macro features
and parallelability.</p>
</dd>
<dd>
<p>A port of dmake for Windows is available from:</p>
</dd>
<dd>
<pre>
    <a href="http://search.cpan.org/dist/dmake/">http://search.cpan.org/dist/dmake/</a></pre>
</dd>
<dd>
<p>Fetch and install dmake somewhere on your path.</p>
</dd>
<dd>
<p>There exists a minor coexistence problem with dmake and Borland C++
compilers.  Namely, if a distribution has C files named with mixed
case letters, they will be compiled into appropriate .obj-files named
with all lowercase letters, and every time dmake is invoked
to bring files up to date, it will try to recompile such files again.
For example, Tk distribution has a lot of such files, resulting in
needless recompiles every time dmake is invoked.  To avoid this, you
may use the script &quot;sync_ext.pl&quot; after a successful build.  It is
available in the win32 subdirectory of the Perl source distribution.</p>
</dd>
</li>
<dt><strong><a name="item_command_shell">Command Shell</a></strong>

<dd>
<p>Use the default &quot;cmd&quot; shell that comes with NT.  Some versions of the
popular 4DOS/NT shell have incompatibilities that may cause you trouble.
If the build fails under that shell, try building again with the cmd
shell.</p>
</dd>
<dd>
<p>The nmake Makefile also has known incompatibilities with the
&quot;command.com&quot; shell that comes with Windows 9x.  You will need to
use dmake and makefile.mk to build under Windows 9x.</p>
</dd>
<dd>
<p>The surest way to build it is on Windows NT/2000/XP, using the cmd shell.</p>
</dd>
<dd>
<p>Make sure the path to the build directory does not contain spaces.  The
build usually works in this circumstance, but some tests will fail.</p>
</dd>
</li>
<dt><strong><a name="item_borland_c_2b_2b">Borland C++</a></strong>

<dd>
<p>If you are using the Borland compiler, you will need dmake.
(The make that Borland supplies is seriously crippled and will not
work for MakeMaker builds.)</p>
</dd>
<dd>
<p>See <a href="#item_make">Make</a> above.</p>
</dd>
</li>
<dt><strong><a name="item_microsoft_visual_c_2b_2b">Microsoft Visual C++</a></strong>

<dd>
<p>The nmake that comes with Visual C++ will suffice for building.
You will need to run the VCVARS32.BAT file, usually found somewhere
like C:\MSDEV4.2\BIN or C:\Program Files\Microsoft Visual Studio\VC98\Bin.
This will set your build environment.</p>
</dd>
<dd>
<p>You can also use dmake to build using Visual C++; provided, however,
you set OSRELEASE to &quot;microsft&quot; (or whatever the directory name
under which the Visual C dmake configuration lives) in your environment
and edit win32/config.vc to change &quot;make=nmake&quot; into &quot;make=dmake&quot;.  The
latter step is only essential if you want to use dmake as your default
make for building extensions using MakeMaker.</p>
</dd>
</li>
<dt><strong><a name="item_microsoft_visual_c_2b_2b_toolkit_2003">Microsoft Visual C++ Toolkit 2003</a></strong>

<dd>
<p>This free toolkit contains the same compiler and linker that ship with
Visual Studio .NET 2003 Professional, but doesn't contain everything
necessary to build Perl.</p>
</dd>
<dd>
<p>You will also need to download the &quot;Platform SDK&quot; (the &quot;Core SDK&quot; and &quot;MDAC
SDK&quot; components are required) for header files, libraries and rc.exe, and
&quot;.NET Framework SDK&quot; for more libraries and nmake.exe.  Note that the latter
(which also includes the free compiler and linker) requires the &quot;.NET
Framework Redistributable&quot; to be installed first.  This can be downloaded and
installed separately, but is included in the &quot;Visual C++ Toolkit 2003&quot; anyway.</p>
</dd>
<dd>
<p>These packages can all be downloaded by searching in the Download Center at
<a href="http://www.microsoft.com/downloads/search.aspx?displaylang=en.">http://www.microsoft.com/downloads/search.aspx?displaylang=en.</a>  (Providing exact
links to these packages has proven a pointless task because the links keep on
changing so often.)</p>
</dd>
<dd>
<p>Try to obtain the latest version of the Platform SDK.  Sometimes these packages
contain a particular Windows OS version in their name, but actually work on
other OS versions too.  For example, the &quot;Windows Server 2003 SP1 Platform SDK&quot;
also runs on Windows XP SP2 and Windows 2000.</p>
</dd>
<dd>
<p>According to the download pages the Toolkit and the .NET Framework SDK are only
supported on Windows 2000/XP/2003, so trying to use these tools on Windows
95/98/ME and even Windows NT probably won't work.</p>
</dd>
<dd>
<p>Install the Toolkit first, then the Platform SDK, then the .NET Framework SDK.
Setup your environment as follows (assuming default installation locations
were chosen):</p>
</dd>
<dd>
<pre>
        <span class="variable">SET</span> <span class="variable">PATH</span><span class="operator">=</span><span class="variable">%SystemRoot%\</span><span class="variable">system32</span><span class="operator">;</span><span class="variable">%SystemRoot%;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">Visual</span> <span class="variable">C</span><span class="operator">++</span> <span class="variable">Toolkit</span> <span class="number">2003</span><span class="operator">\</span><span class="variable">bin</span><span class="operator">;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">SDK</span><span class="operator">\</span><span class="variable">Bin</span><span class="operator">;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span><span class="operator">.</span><span class="variable">NET</span><span class="operator">\</span><span class="variable">SDK</span><span class="operator">\</span><span class="variable">v1</span><span class="number">.1</span><span class="operator">\</span><span class="variable">Bin</span>
        <span class="variable">SET</span> <span class="variable">INCLUDE</span><span class="operator">=</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">Visual</span> <span class="variable">C</span><span class="operator">++</span> <span class="variable">Toolkit</span> <span class="number">2003</span><span class="operator">\</span><span class="variable">include</span><span class="operator">;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">SDK</span><span class="operator">\</span><span class="variable">include</span><span class="operator">;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">Visual</span> <span class="variable">Studio</span> <span class="operator">.</span><span class="variable">NET</span> <span class="number">2003</span><span class="operator">\</span><span class="variable">Vc7</span><span class="operator">\</span><span class="variable">include</span>
        <span class="variable">SET</span> <span class="variable">LIB</span><span class="operator">=</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">Visual</span> <span class="variable">C</span><span class="operator">++</span> <span class="variable">Toolkit</span> <span class="number">2003</span><span class="operator">\</span><span class="variable">lib</span><span class="operator">;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">SDK</span><span class="operator">\</span><span class="variable">lib</span><span class="operator">;</span><span class="variable">C</span><span class="operator">:\</span><span class="variable">Program</span> <span class="variable">Files</span><span class="operator">\</span><span class="variable">Microsoft</span> <span class="variable">Visual</span> <span class="variable">Studio</span> <span class="operator">.</span><span class="variable">NET</span> <span class="number">2003</span><span class="operator">\</span><span class="variable">Vc7</span><span class="operator">\</span><span class="variable">lib</span>
</pre>
</dd>
<dd>
<p>Several required files will still be missing:</p>
</dd>
<ul>
<li>
<p>cvtres.exe is required by link.exe when using a .res file.  It is actually
installed by the .NET Framework SDK, but into a location such as the
following:</p>
<pre>
        C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322</pre>
<p>Copy it from there to C:\Program Files\Microsoft SDK\Bin</p>
</li>
<li>
<p>lib.exe is normally used to build libraries, but link.exe with the /lib
option also works, so change win32/config.vc to use it instead:</p>
<p>Change the line reading:</p>
<pre>
        ar='lib'</pre>
<p>to:</p>
<pre>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?