]> granicus.if.org Git - apache/blob - docs/manual/platform/win_compiling.html.en
6e7d42df6f1caecb09bc6b14267ffe74e54bdfb7
[apache] / docs / manual / platform / win_compiling.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>Compiling Apache for Microsoft Windows - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body id="manual-page"><div id="page-header">
14 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
15 <p class="apache">Apache HTTP Server Version 2.3</p>
16 <img alt="" src="../images/feather.gif" /></div>
17 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
18 <div id="path">
19 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Platform Specific Notes</a></div><div id="page-content"><div id="preamble"><h1>Compiling Apache for Microsoft Windows</h1>
20 <div class="toplang">
21 <p><span>Available Languages: </span><a href="../en/platform/win_compiling.html" title="English">&nbsp;en&nbsp;</a> |
22 <a href="../ko/platform/win_compiling.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
23 </div>
24
25
26     <p>There are many important points before you begin compiling
27     Apache. See <a href="windows.html">Using Apache with Microsoft
28     Windows</a> before you begin.</p>
29
30   </div>
31 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#requirements">Requirements</a></li>
32 <li><img alt="" src="../images/down.gif" /> <a href="#commandbuild">Command-Line Build</a></li>
33 <li><img alt="" src="../images/down.gif" /> <a href="#workspacebuild">Developer Studio Workspace IDE Build</a></li>
34 <li><img alt="" src="../images/down.gif" /> <a href="#projectcomponents">Project Components</a></li>
35 </ul></div>
36 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
37 <div class="section">
38 <h2><a name="requirements" id="requirements">Requirements</a></h2>
39
40     
41
42     <p>Compiling Apache requires the following environment to be
43     properly installed:</p>
44
45     <ul>
46       <li>
47         <p>Disk Space</p>
48         <p>Make sure you have at least 180 MB of free disk space
49         available. After installation Apache requires approximately
50         70 MB of disk space, plus space for log and cache files,
51         which can grow rapidly. The actual disk space requirements
52         will vary considerably based on your chosen configuration and
53         any third-party modules or libraries, especially when OpenSSL
54         is also built.  Because many files are text and very easily
55         compressed, NTFS filesystem compression cuts these requirements
56         in half.</p>
57       </li>
58
59       <li>
60         <p>Microsoft Visual C++ (Microsoft Visual Studio) 6.0 or higher.</p>
61
62         <p>Apache can be built using the command line tools, or from
63         within the Visual Studio IDE Workbench.  The command line
64         build requires the environment to reflect the <code>PATH</code>,
65         <code>INCLUDE</code>, <code>LIB</code> and other variables
66         that can be configured with the <code>vcvars32.bat</code> file:</p>
67
68         <div class="example"><p><code>
69           "c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32"
70         </code></p></div>
71       </li>
72
73       <li>
74         <p>The Windows Platform SDK for Visual C++ 6.0 (97) or 7.0 (.NET)</p>
75
76         <p>Apache's APR and APR-util builds require an updated Microsoft
77         Windows Platform SDK, from Feb 2003 or later, included in the
78         Visual C++ 7.1 (Studio 2003) and later.  For command line builds with 
79         Visual C++ 6.0 or 7.0, the Platform SDK environment is prepared by 
80         the <code>setenv.bat</code> file:</p>
81         <div class="example"><p><code>
82           "c:\Program Files\Platform SDK\setenv.bat"
83         </code></p></div>
84
85         <p>The Platform SDK files distributed with Visual C++ 6.0 and
86         Visual Studio .NET (2000) are no longer sufficient and cause many
87         compilation warnings and linkage errors.  Users of Visual C++ 7.1
88         (Studio 2003) and later versions (of the full product, not the 
89         'Visual Studio Express' flavor) may skip this requirement.</p>
90
91         <p>If using the GUI, either start msdev or devenv with the /setenv
92         flag (after invoking setenv.bat), or ensure the paths are correct
93         under the Tools -&gt; Options -&gt; (Projects -&gt;) Directories 
94         menu option.  The Platform SDK installer will generally help you
95         configure this.</p>
96       </li>
97
98       <li>
99         <p>The awk utility (awk, gawk or similar).</p>
100         <p>To install Apache within the build system, several files are
101         modified using the <code>awk.exe</code> utility. awk was chosen since
102         it is a very small download (compared with Perl or WSH/VB) and
103         accomplishes the task of modifying configuration files upon
104         installation.  Brian Kernighan's
105         <a href="http://cm.bell-labs.com/cm/cs/who/bwk/">http://cm.bell-labs.com/cm/cs/who/bwk/</a>
106         site has a compiled native Win32 binary,
107         <a href="http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe">http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe</a> which
108         you must save with the name <code>awk.exe</code> rather than
109         <code>awk95.exe</code>.</p>
110
111         <div class="note">If awk.exe is not found, Makefile.win's install target
112         will not perform substitutions in the installed .conf files.
113         The installed .conf files must then be modified by hand for
114         this situation.</div>
115
116         <p>Note that Developer Studio IDE will only find
117         <code>awk.exe</code> from the Executable path specified in the menu 
118         option Tools -&gt; Options -&gt; (Projects -&gt;) Directories.
119         Add the path for <code>awk.exe</code> to this list, and your 
120         system <code>PATH</code> environment variable, as needed.</p>
121
122         <div class="note">Also note that if you are using Cygwin tools
123         (<a href="http://www.cygwin.com/">http://www.cygwin.com/</a>) 
124         the awk utility is named <code>gawk.exe</code> and that the file 
125         <code>awk.exe</code> is really a symlink to the <code>gawk.exe</code>
126         file. The Windows command shell does not recognize symlinks, and 
127         because of this building InstallBin will fail. A workaround is 
128         to delete <code>awk.exe</code> from the cygwin installation and 
129         copy <code>gawk.exe</code> to <code>awk.exe</code>.  Also note the
130         cygwin/mingw ports of gawk 3.0.x were buggy, please upgrade to 3.1.x
131         before attempting to use any gawk port.</div>
132       </li>
133
134       <li>
135         <p>[Optional] zlib library (for <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>)</p>
136         <p>Zlib must be installed into a <code>srclib</code> subdirectory named
137         <code>zlib</code>.  This must be built in-place.  Zlib can be obtained 
138         from <a href="http://www.zlib.net/">http://www.zlib.net/</a> -- the
139         <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code> is confirmed to work correctly with 
140         version 1.2.3.</p>
141
142         <div class="example"><p><code>
143           nmake -f win32\Makefile.msc<br />
144           nmake -f win32\Makefile.msc test
145         </code></p></div>
146       </li>
147
148       <li>
149         <p>[Optional] OpenSSL libraries (for <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>
150         and <code>ab.exe</code> with ssl support)</p>
151         <p><strong>Caution: there are significant restrictions and
152         prohibitions on the use and distribution of strong cryptography
153         and patented intellectual property throughout the world.</strong>
154         OpenSSL includes strong cryptography controlled by both export
155         regulations and domestic law, as well as intellectual property
156         protected by patent, in the United States and elsewhere.  Neither
157         the Apache Software Foundation nor the OpenSSL project can provide
158         legal advise regarding possession, use, or distribution of the code
159         provided by the OpenSSL project. <strong>Consult your own legal
160         counsel, you are responsible for your own actions.</strong></p>
161
162         <p>OpenSSL must be installed into a <code>srclib</code> subdirectory 
163         named <code>openssl</code>, obtained from 
164         <a href="http://www.openssl.org/source/">http://www.openssl.org/source/</a>, in order to compile 
165         <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> or the abs project (<code>ab.exe</code> 
166         enabled with SSL support.) To prepare OpenSSL for both 
167         <code>release</code> and <code>debug</code> builds of Apache,
168         disable the patent encumbered features in OpenSSL, using zlib
169         as compiled above you might use the following build commands:</p>
170
171         <div class="example"><p><code>
172           perl Configure no-rc5 no-idea enable-zlib VC-WIN32 -Ipath/to/srclib/zlib<br />
173           ms\do_masm.bat<br />
174           nmake -f ms\ntdll.mak
175         </code></p></div>
176
177         <p>Note: It is not advisable to use zlib-dynamic, as that could
178         pose a thread race condition.  If building zlib on win32, be sure
179         to adjust the resulting ms\ntdll.mak file to link to the full
180         path of srclib\zlib\zdll.lib rather than zlib1.lib (that error in
181         configuration of OpenSSL through 0.9.8h and earlier reflects older 
182         zlib 1.1 versions.)</p>
183       </li>
184
185     </ul>
186
187   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
188 <div class="section">
189 <h2><a name="commandbuild" id="commandbuild">Command-Line Build</a></h2>
190
191     
192
193     <p>First, unpack the Apache distribution into an appropriate
194     directory. Open a command-line prompt and <code>cd</code> to that
195     directory.</p>
196
197     <p>The master Apache makefile instructions are contained in the
198     <code>Makefile.win</code> file. To compile Apache on Windows
199     NT, simply use one of the following commands to compiled the
200     <code>release</code> or <code>debug</code> build, respectively:</p>
201
202     <div class="example"><pre>
203 nmake /f Makefile.win _apacher
204
205 nmake /f Makefile.win _apached
206     </pre></div>
207
208     <p>Either command will compile Apache. The latter will disable
209     optimization of the resulting files, making it easier to single
210     step the code to find bugs and track down problems.</p>
211
212     <p>You can add your apr-util dbd provider choices with the additional
213     make variable DBD_LIST, e.g. DBD_LIST="mysql oracle pgsql sqlite3"
214     to build these four providers.  However it's necessary to have 
215     the include headers in the INCLUDE path list, db client libraries 
216     in the LIB path list, and the db client dll files in the PATH.  The
217     specifics for each provider are an exercise left to the reader.</p>
218
219   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
220 <div class="section">
221 <h2><a name="workspacebuild" id="workspacebuild">Developer Studio Workspace IDE Build</a></h2>
222
223     
224
225     <p>Apache can also be compiled using VC++'s Visual Studio
226     development environment. To simplify this process, a
227     Visual Studio workspace, <code>Apache.dsw</code>, is provided.
228     This workspace exposes the entire list of working <code>.dsp</code>
229     projects that are required for the complete Apache binary release.
230     It includes dependencies between the projects to assure that they
231     are built in the appropriate order.</p>
232
233     <p>Open the <code>Apache.dsw</code> workspace, and select
234     <code>InstallBin</code> (<code>Release</code> or <code>Debug</code> build,
235     as desired) as the Active Project. <code>InstallBin</code> causes all
236     related project to be built, and then invokes <code>Makefile.win</code> to
237     move the compiled executables and dlls. You may personalize the
238     <code>INSTDIR=</code> choice by changing <code>InstallBin</code>'s Settings,
239     General tab, Build command line entry. <code>INSTDIR</code> defaults to the
240     <code>/Apache2</code> directory. If you only want a test compile (without
241     installing) you may build the <code>BuildBin</code> project instead.</p>
242
243     <p>The <code>.dsp</code> project files are distributed in Visual
244     C++ 6.0 format. Visual C++ 5.0 (97) will recognize them. Visual C++
245     7.0 (.net) must convert <code>Apache.dsw</code> plus the <code>.dsp</code>
246     files into an <code>Apache.sln</code> plus <code>.msproj</code> files,
247     be sure you reconvert the <code>.msproj</code> file if any of the source
248     <code>.dsp</code> files change! This is really trivial, just open
249     <code>Apache.dsw</code> in the VC++ 7.0 IDE once again.</p>
250
251     <div class="note">There is a flaw in the .vcproj conversion of .dsp through 
252     Visual Studio 2005 SP1; devenv.exe will mis-parse the /D flag for RC 
253     flags containing long quoted /D'efines containing spaces.  The command:
254     <div class="example"><p><code>
255       perl srclib\apr\build\cvtdsp.pl -2005
256     </code></p></div>
257     will convert the /D flags for RC flags to use an alternate, parseable
258     syntax; unfortunately this syntax isn't supported by Visual Studio 97
259     or it's exported .mak files.  These /D flags are used to pass the long
260     description of the mod_apachemodule.so files to their .rc resource
261     version-identifier compilations, and replace the use of awk for generating
262     .rc files formerly used for Apache 2.0.</div>
263
264     <p>Visual C++ 7.0 (.net) users should also use the Build
265     menu, Configuration Manager dialog to uncheck both the <code>Debug</code>
266     and <code>Release</code> Solution modules abs, <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>
267     and <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>.
268     These modules are built by invoking <code>nmake</code> or the IDE directly
269     with the <code>BinBuild</code> target to build those modules conditionally
270     if the <code>srclib</code> directories <code>openssl</code> and/or
271     <code>zlib</code> exist.</p>
272
273     <p>Exported <code>.mak</code> files pose a greater hassle, but they are
274     required for Visual C++ 5.0 users to build <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>,
275     abs (<code class="program"><a href="../programs/ab.html">ab</a></code> with SSL support) and/or
276     <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>.  VC++ 7.0 (Visual Studio .NET) users 
277     also benefit, <code>nmake</code> builds were faster than 
278     <code>binenv</code> builds until the parallel compilation features
279     introduced in Visual Studio 2005.  Build the entire project from within 
280     the VC++ 5.0 or 6.0 IDE, preferably with mod_deflate, mod_ssl and abs,
281     then use the Project Menu Export for all makefiles (preferably, with 
282     dependencies.)  You must build the projects first in order to create 
283     all dynamic auto-generated targets, so that dependencies can be parsed
284     correctly. Run the following command to fix the paths so they will build 
285     anywhere:</p>
286
287     <div class="example"><p><code>
288       perl srclib\apr\build\fixwin32mak.pl
289     </code></p></div>
290
291     <p>You must type this command from the <em>top level</em>
292     directory of the httpd source tree. Every
293     <code>.mak</code> and <code>.dep</code> project file within
294     the current directory and below will be corrected, and the
295     timestamps adjusted to reflect the <code>.dsp</code>.</p>
296
297     <p>If you contribute back a patch that revises project files, we
298     must commit project files in Visual Studio 6.0 format. Changes
299     should be simple, with minimal compilation and linkage flags that
300     will be recognized by all VC++ 5.0 through 7.0 environments.</p>
301
302   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
303 <div class="section">
304 <h2><a name="projectcomponents" id="projectcomponents">Project Components</a></h2>
305
306     
307
308     <p>The <code>Apache.dsw</code> workspace and <code>makefile.win</code>
309     <code>nmake</code> script both build the <code>.dsp</code> projects
310     of the Apache server in the following sequence:</p>
311
312     <ol>
313       <li><code>srclib\apr\apr.dsp</code></li>
314
315       <li><code>srclib\apr\libapr.dsp</code></li>
316
317       <li><code>srclib\apr-util\uri\gen_uri_delims.dsp</code></li>
318
319       <li><code>srclib\apr-util\xml\expat\lib\xml.dsp</code></li>
320
321       <li><code>srclib\apr-util\aprutil.dsp</code></li>
322
323       <li><code>srclib\apr-util\libaprutil.dsp</code></li>
324
325       <li><code>srclib\pcre\dftables.dsp</code></li>
326
327       <li><code>srclib\pcre\pcre.dsp</code></li>
328
329       <li><code>srclib\pcre\pcreposix.dsp</code></li>
330
331       <li><code>server\gen_test_char.dsp</code></li>
332
333       <li><code>libhttpd.dsp</code></li>
334
335       <li><code>Apache.dsp</code></li>
336     </ol>
337
338     <p>In addition, the <code>modules\</code> subdirectory tree contains
339     project files for the majority of the modules.</p>
340
341     <p>The <code>support\</code> directory contains project files for
342     additional programs that are not part of the Apache runtime,
343     but are used by the administrator to test Apache and maintain
344     password and log files. Windows-specific support projects are
345     broken out in the <code>support\win32\</code> directory.</p>
346
347     <ol>
348       <li><code>support\ab.dsp</code></li>
349
350       <li><code>support\htdigest.dsp</code></li>
351
352       <li><code>support\htpasswd.dsp</code></li>
353
354       <li><code>support\logresolve.dsp</code></li>
355
356       <li><code>support\rotatelogs.dsp</code></li>
357
358       <li><code>support\win32\ApacheMonitor.dsp</code></li>
359
360       <li><code>support\win32\wintty.dsp</code></li>
361     </ol>
362
363     <p>Once Apache has been compiled, it needs to be installed in
364     its server root directory. The default is the
365     <code>\Apache2</code> directory, of the same drive.</p>
366
367     <p>To build and install all the files into the desired folder
368     <em>dir</em> automatically, use one of the following
369     <code>nmake</code> commands:</p>
370
371     <div class="example"><pre>
372 nmake /f Makefile.win installr INSTDIR=<em>dir</em>
373
374 nmake /f Makefile.win installd INSTDIR=<em>dir</em>
375     </pre></div>
376
377     <p>The <em>dir</em> argument to <code>INSTDIR</code> gives
378     the installation directory; it can be omitted if Apache is
379     to be installed into <code>\Apache2</code>.</p>
380
381     <p>This will install the following:</p>
382
383     <ul>
384       <li><code><em>dir</em>\bin\httpd.exe</code> - Apache
385       executable</li>
386
387       <li><code><em>dir</em>\bin\ApacheMonitor.exe</code> - Service
388       monitor taskbar icon utility</li>
389
390       <li><code><em>dir</em>\bin\htdigest.exe</code> - Digest auth
391       password file utility</li>
392
393       <li><code><em>dir</em>\bin\htdbm.exe</code> - SDBM auth
394       database password file utility</li>
395
396       <li><code><em>dir</em>\bin\htpasswd.exe</code> - Basic auth
397       password file utility</li>
398
399       <li><code><em>dir</em>\bin\logresolve.exe</code> - Log file
400       dns name lookup utility</li>
401
402       <li><code><em>dir</em>\bin\rotatelogs.exe</code> - Log file
403       cycling utility</li>
404
405       <li><code><em>dir</em>\bin\wintty.exe</code> - Console window
406       utility</li>
407
408       <li><code><em>dir</em>\bin\libapr.dll</code> - Apache
409       Portable Runtime shared library</li>
410
411       <li><code><em>dir</em>\bin\libaprutil.dll</code> - Apache
412       Utility Runtime shared library</li>
413
414       <li><code><em>dir</em>\bin\libhttpd.dll</code> - Apache Core
415       library</li>
416
417       <li><code><em>dir</em>\modules\mod_*.so</code> - Loadable
418       Apache modules</li>
419
420       <li><code><em>dir</em>\conf</code> - Configuration
421       directory</li>
422
423       <li><code><em>dir</em>\logs</code> - Empty logging
424       directory</li>
425
426       <li><code><em>dir</em>\include</code> - C language header
427       files</li>
428
429       <li><code><em>dir</em>\lib</code> - Link library files</li>
430     </ul>
431
432     <h3><a name="projectcomponents-warn" id="projectcomponents-warn">Warning about building Apache from the development tree</a></h3>
433
434       
435
436       <div class="note">Note only the <code>.dsp</code> files are maintained between <code>release</code>
437       builds. The <code>.mak</code> files are NOT regenerated, due to the tremendous
438       waste of reviewer's time. Therefore, you cannot rely on the <code>NMAKE</code>
439       commands above to build revised <code>.dsp</code> project files unless you
440       then export all <code>.mak</code> files yourself from the project. This is
441       unnecessary if you build from within the Microsoft
442       Developer Studio environment.</div>
443
444       <div class="note">Also note it is very worthwhile to build the <code>BuildBin</code>
445       target project (or the command line <code>_apacher</code> or
446       <code>_apached</code> target) prior to exporting the make files.
447       Many files are autogenerated in the build process. Only a full
448       build provides all of the dependent files required to build proper
449       dependency trees for correct build behavior.</div>
450
451       <p>In order to create distribution <code>.mak</code> files, always 
452       review the generated <code>.mak</code> (or <code>.dep</code>) 
453       dependencies for Platform SDK or other garbage, machine specific
454       includes.  The <code>DevStudio\SharedIDE\bin\</code> (VC5) or 
455       <code>DevStudio\Common\MSDev98\bin\</code> (VC6) directory contains
456       the <code>sysincl.dat</code> file, which must list all exceptions. 
457       Update this file (including both forward and backslashed paths, such 
458       as both <code>sys/time.h</code> and <code>sys\time.h</code>) to ignore 
459       such dependencies.  Including local-install paths in a distributed 
460       <code>.mak</code> file will cause the build to fail completely. And 
461       don't forget to run <code>srclib/apr/build/fixwin32mak.pl</code> in 
462       order to fix absolute paths within the <code>.mak</code> files.</p>
463
464     
465
466   </div></div>
467 <div class="bottomlang">
468 <p><span>Available Languages: </span><a href="../en/platform/win_compiling.html" title="English">&nbsp;en&nbsp;</a> |
469 <a href="../ko/platform/win_compiling.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
470 </div><div id="footer">
471 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
472 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
473 </body></html>