]> granicus.if.org Git - apache/blob - docs/manual/platform/win_compiling.html.en
update transformation
[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="#workspacebuild">Exporting command-line .mak files</a></li>
35 <li><img alt="" src="../images/down.gif" /> <a href="#installation">Installation</a></li>
36 <li><img alt="" src="../images/down.gif" /> <a href="#projectcomponents-warn">Warning about building Apache from the development tree</a></li>
37 </ul></div>
38 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
39 <div class="section">
40 <h2><a name="requirements" id="requirements">Requirements</a></h2>
41
42     
43
44     <p>Compiling Apache requires the following environment to be
45     properly installed:</p>
46
47     <ul>
48       <li>
49         <p>Disk Space</p>
50
51         <p>Make sure you have at least 200 MB of free disk space
52         available. After installation Apache requires approximately
53         80 MB of disk space, plus space for log and cache files,
54         which can grow rapidly. The actual disk space requirements
55         will vary considerably based on your chosen configuration and
56         any third-party modules or libraries, especially when OpenSSL
57         is also built.  Because many files are text and very easily
58         compressed, NTFS filesystem compression cuts these requirements
59         in half.</p>
60       </li>
61
62       <li>
63         <p>Appropriate Patches</p>
64
65         <p>The httpd binary is built with the help of several patches to
66         third party packages, which ensure the released code is buildable
67         and debuggable.  These patches are available and distributed from <a href="http://www.apache.org/dist/httpd/binaries/win32/patches_applied/">http://www.apache.org/dist/httpd/binaries/win32/patches_applied/</a>
68         and are recommended to be applied to obtain identical results as the
69         "official" ASF distributed binaries.</p>
70       </li>
71
72       <li>
73         <p>Microsoft Visual C++ 6.0 (Visual Studio 97) or later.</p>
74
75         <p>Apache can be built using the command line tools, or from
76         within the Visual Studio IDE Workbench.  The command line
77         build requires the environment to reflect the <code>PATH</code>,
78         <code>INCLUDE</code>, <code>LIB</code> and other variables
79         that can be configured with the <code>vcvars32.bat</code> script.</p>
80
81         <div class="note">You may want the Visual Studio Processor Pack for your older
82         version of Visual Studio, or a full (not Express) version of newer
83         Visual Studio editions, for the ml.exe assembler.  This will allow
84         you to build OpenSSL, if desired, using the more efficient assembly
85         code implementation.</div>
86
87         <div class="note">Only the Microsoft compiler tool chain is actively supported by
88         the active httpd contributors.  Although the project regularly accepts
89         patches to ensure MinGW and other alternative builds work and improve
90         upon them, they are not actively maintained and are often broken in
91         the course of normal development.</div>
92       </li>
93
94       <li>
95         <p>Updated Microsoft Windows Platform SDK, February 2003 or later.</p>
96
97         <p>An appropriate Windows Platform SDK is included by default in the
98         full (not express/lite) versions  of Visual C++ 7.1 (Visual Studio 2002)
99         and later, these users can ignore these steps unless explicitly choosing
100         a newer or different version of the Platform SDK.</p>
101
102         <p>To use Visual C++ 6.0 or 7.0 (Studio 2000 .NET), the Platform SDK
103         environment must be prepared using the <code>setenv.bat</code> 
104         script (installed by the Platform SDK) before starting the command
105         line build or launching the msdev/devenv GUI environment.  Installing
106         the Platform SDK for Visual Studio Express versions (2003 and later)
107         should adjust the default environment appropriately.</p>
108
109         <div class="example"><p><code>
110           "c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32"<br />
111           "c:\Program Files\Platform SDK\setenv.bat"
112         </code></p></div>
113       </li>
114
115       <li>
116         <p>Perl and awk</p>
117
118         <p>Several steps recommended here require a perl interpreter during
119         the build preparation process, but it is otherwise not required.</p>
120  
121         <p>To install Apache within the build system, several files are
122         modified using the <code>awk.exe</code> utility. awk was chosen since
123         it is a very small download (compared with Perl or WSH/VB) and
124         accomplishes the task of modifying configuration files upon
125         installation.  Brian Kernighan's
126         <a href="http://www.cs.princeton.edu/~bwk/btl.mirror/">http://www.cs.princeton.edu/~bwk/btl.mirror/</a>
127         site has a compiled native Win32 binary,
128         <a href="http://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe">http://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe</a> which
129         you must save with the name <code>awk.exe</code> (rather than
130         <code>awk95.exe</code>).</p>
131
132         <div class="note">If awk.exe is not found, Makefile.win's install target
133         will not perform substitutions in the installed .conf files.
134         You must manually modify the installed .conf files to allow
135         the server to start.  Search and replace all "@token@" tags
136         as appropriate.</div>
137
138         <div class="note">The Visual Studio IDE will only find <code>awk.exe</code>
139         from the PATH, or executable path specified in the menu option
140         Tools -&gt; Options -&gt; (Projects -&gt;) Directories.  Ensure
141         awk.exe is in your system path.</div>
142
143         <div class="note">Also note that if you are using Cygwin tools
144         (<a href="http://www.cygwin.com/">http://www.cygwin.com/</a>) 
145         the awk utility is named <code>gawk.exe</code> and that the file 
146         <code>awk.exe</code> is really a symlink to the <code>gawk.exe</code>
147         file. The Windows command shell does not recognize symlinks, and 
148         because of this building InstallBin will fail. A workaround is 
149         to delete <code>awk.exe</code> from the cygwin installation and 
150         copy <code>gawk.exe</code> to <code>awk.exe</code>.  Also note the
151         cygwin/mingw ports of gawk 3.0.x were buggy, please upgrade to 3.1.x
152         before attempting to use any gawk port.</div>
153       </li>
154
155       <li>
156         <p>[Optional] zlib library (for <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>)</p>
157
158         <p>Zlib must be installed into a <code>srclib</code> subdirectory named
159         <code>zlib</code>.  This must be built in-place.  Zlib can be obtained 
160         from <a href="http://www.zlib.net/">http://www.zlib.net/</a> -- the
161         <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code> is confirmed to work correctly with 
162         version 1.2.3.</p>
163
164         <div class="example"><p><code>
165           nmake -f win32\Makefile.msc<br />
166           nmake -f win32\Makefile.msc test
167         </code></p></div>
168       </li>
169
170       <li>
171         <p>[Optional] OpenSSL libraries (for <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>
172         and <code>ab.exe</code> with ssl support)</p>
173
174         <div class="note">The OpenSSL library is cryptographic software.  The country
175         in which you currently reside may have restrictions on the import,
176         possession, use, and/or re-export to another country, of encryption
177         software.  BEFORE using any encryption software, please check your
178         country's laws, regulations and policies concerning the import,
179         possession, or use, and re-export of encryption software, to see
180         if this is permitted.  See 
181         <a href="http://www.wassenaar.org/">http://www.wassenaar.org/</a>
182         for more information.</div>
183
184         <p>Configuring and building OpenSSL requires perl to be installed.</p>
185
186         <p>OpenSSL must be installed into a <code>srclib</code> subdirectory 
187         named <code>openssl</code>, obtained from 
188         <a href="http://www.openssl.org/source/">http://www.openssl.org/source/</a>, in order to compile 
189         <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> or the <code>abs.exe</code> project, which
190         is ab.c with SSL support enabled.  To prepare OpenSSL to be linked 
191         to Apache mod_ssl or abs.exe, and disable patent encumbered features
192         in OpenSSL,  you might use the following build commands:</p>
193
194         <div class="example"><p><code>
195           perl Configure no-rc5 no-idea enable-mdc2 enable-zlib VC-WIN32 
196                -Ipath/to/srclib/zlib -Lpath/to/srclib/zlib<br />
197           ms\do_masm.bat<br />
198           nmake -f ms\ntdll.mak
199         </code></p></div>
200
201         <div class="note">It is not advisable to use zlib-dynamic, as that transfers
202         the cost of deflating SSL streams to the first request which must
203         load the zlib dll.  Note the suggested patch enables the -L flag to
204         work with windows builds, corrects the name of zdll.lib and ensures
205         .pdb files are generated for troubleshooting.  If the assembler is
206         not installed, you would add no-asm above and use ms\do_ms.bat 
207         instead of the ms\do_masm.bat script.</div>
208       </li>
209
210       <li>
211         <p>[Optional] Database libraries (for <code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code>
212         and <code class="module"><a href="../mod/mod_dbm.html">mod_dbm</a></code>)</p>
213
214         <p>The apr-util library exposes dbm (keyed database) and dbd (query
215         oriented database) client functionality to the httpd server and its
216         modules, such as authentication and authorization.  The sdbm dbm and
217         odbc dbd providers are compiled unconditionally.</p>
218
219         <p>The dbd support includes the Oracle instantclient package, MySQL,
220         PostgreSQL and sqlite.  To build these all, for example, set up the
221         LIB to include the library path, INCLUDE to include the headers path,
222         and PATH to include the dll bin path of all four SDK's, and set the
223         DBD_LIST environment variable to inform the build which client driver
224         SDKs are installed correctly, e.g.;</p>
225
226         <div class="example"><p><code>
227           set DBD_LIST=sqlite3 pgsql oracle mysql
228         </code></p></div>
229
230         <p>Similarly, the dbm support can be extended with DBM_LIST to
231         build a Berkeley DB provider (db) and/or gdbm provider, by similarly
232         configuring LIB, INCLUDE and PATH first to ensure the client library
233         libs and headers are available.</p>
234
235         <div class="example"><p><code>
236           set DBM_LIST=db gdbm
237         </code></p></div>
238
239         <div class="note">Depending on the choice of database distributions, it may be
240         necessary to change the actual link target name (e.g. gdbm.lib vs.
241         libgdb.lib) that are listed in the corresponding .dsp/.mak files
242         within the directories srclib\apr-util\dbd or ...\dbm.</div>
243
244         <p>See the README-win32.txt file for more hints on obtaining the
245         various database driver SDKs.</p>
246       </li>
247     </ul>
248
249   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
250 <div class="section">
251 <h2><a name="commandbuild" id="commandbuild">Command-Line Build</a></h2>
252
253     
254
255     <p><code>Makefile.win</code> is the top level Apache makefile.
256     To compile Apache on Windows, simply use one of the following commands
257     to build the <code>release</code> or <code>debug</code> flavor:</p>
258
259     <div class="example"><p><code>
260       nmake /f Makefile.win _apacher<br /><br />
261       nmake /f Makefile.win _apached
262     </code></p></div>
263
264     <p>Either command will compile Apache. The latter will disable
265     optimization of the resulting files, making it easier to single
266     step the code to find bugs and track down problems.</p>
267
268     <p>You can add your apr-util dbd and dbm provider choices with the
269     additional make (environment) variables DBD_LIST and DBM_LIST, 
270     see the comments about [Optional] Database libraries, above.
271     Review the initial comments in Makefile.win for additional options
272     that can be provided when invoking the build.</p>
273
274   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
275 <div class="section">
276 <h2><a name="workspacebuild" id="workspacebuild">Developer Studio Workspace IDE Build</a></h2>
277
278     
279
280     <p>Apache can also be compiled using VC++'s Visual Studio
281     development environment. To simplify this process, a
282     Visual Studio workspace, <code>Apache.dsw</code>, is provided.
283     This workspace exposes the entire list of working <code>.dsp</code>
284     projects that are required for the complete Apache binary release.
285     It includes dependencies between the projects to assure that they
286     are built in the appropriate order.</p>
287
288     <p>Open the <code>Apache.dsw</code> workspace, and select
289     <code>InstallBin</code> (<code>Release</code> or <code>Debug</code> build,
290     as desired) as the Active Project. <code>InstallBin</code> causes all
291     related project to be built, and then invokes <code>Makefile.win</code> to
292     move the compiled executables and dlls. You may personalize the
293     <code>INSTDIR=</code> choice by changing <code>InstallBin</code>'s Settings,
294     General tab, Build command line entry. <code>INSTDIR</code> defaults to the
295     <code>/Apache2</code> directory. If you only want a test compile (without
296     installing) you may build the <code>BuildBin</code> project instead.</p>
297
298     <p>The <code>.dsp</code> project files are distributed in Visual Studio 6.0
299     (98) format. Visual C++ 5.0 (97) will recognize them. Visual Studio
300     2002 (.NET) and later users must convert <code>Apache.dsw</code> plus
301     the <code>.dsp</code> files into an <code>Apache.sln</code> plus
302     <code>.msproj</code> files.  Be sure you reconvert the <code>.msproj</code>
303     file again if its source <code>.dsp</code> file changes! This is really
304     trivial, just open <code>Apache.dsw</code> in the VC++ 7.0 IDE once again
305     and reconvert.</p>
306
307     <div class="note">There is a flaw in the .vcproj conversion of .dsp files.  devenv.exe
308     will mis-parse the /D flag for RC flags containing long quoted /D'efines
309     which contain spaces.  The command:
310     <div class="example"><p><code>
311       perl srclib\apr\build\cvtdsp.pl -2005
312     </code></p></div>
313     will convert the /D flags for RC flags to use an alternate, parseable
314     syntax; unfortunately this syntax isn't supported by Visual Studio 97
315     or its exported .mak files.  These /D flags are used to pass the long
316     description of the mod_apachemodule.so files to the shared .rc resource
317     version-identifier build.</div>
318
319     <p>Visual Studio 2002 (.NET) and later users should also use the Build
320     menu, Configuration Manager dialog to uncheck both the <code>Debug</code>
321     and <code>Release</code> Solution modules <code>abs</code>, 
322     <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code> and <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> components, as
323     well as every component starting with <code>apr_db*</code>.  These modules
324     are built by invoking <code>nmake</code>, or the IDE directly with the
325     <code>BinBuild</code> target, which builds those modules conditionally
326     if the <code>srclib</code> directories <code>openssl</code> and/or
327     <code>zlib</code> exist, and based on the setting of <code>DBD_LIST</code>
328     and <code>DBM_LIST</code> environment variables.</p>
329
330   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
331 <div class="section">
332 <h2><a name="workspacebuild" id="workspacebuild">Exporting command-line .mak files</a></h2>
333
334     
335
336     <p>Exported <code>.mak</code> files pose a greater hassle, but they are
337     required for Visual C++ 5.0 users to build <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>,
338     abs (<code class="program"><a href="../programs/ab.html">ab</a></code> with SSL support) and/or
339     <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>.  The .mak files also support a broader
340     range of C++ tool chain distributions, such as Visual Studio Express.</p>
341
342     <p>You must first build all projects in order to create all dynamic 
343     auto-generated targets, so that dependencies can be parsed correctly. 
344     Build the entire project from within the Visual Studio 6.0 (98) IDE,
345     using the <code>BuildAll</code> target, then use the Project Menu Export
346     for all makefiles (checking on "with dependencies".)  Run the following
347     command to correct absolute paths into relative paths so they will build
348     anywhere:</p>
349
350     <div class="example"><p><code>
351       perl srclib\apr\build\fixwin32mak.pl
352     </code></p></div>
353
354     <p>You must type this command from the <em>top level</em>
355     directory of the httpd source tree. Every
356     <code>.mak</code> and <code>.dep</code> project file within
357     the current directory and below will be corrected, and the
358     timestamps adjusted to reflect the <code>.dsp</code>.</p>
359
360     <p>Always review the generated <code>.mak</code> and <code>.dep</code>
361     files for Platform SDK or other local, machine specific file paths.
362     The <code>DevStudio\Common\MSDev98\bin\</code> (VC6) directory contains
363     a <code>sysincl.dat</code> file, which lists all exceptions.  Update
364     this file (including both forward and backslashed paths, such as both
365     <code>sys/time.h</code> and <code>sys\time.h</code>) to ignore such
366     newer dependencies.  Including local-install paths in a distributed 
367     <code>.mak</code> file will cause the build to fail completely.</p>
368
369     <p>If you contribute back a patch that revises project files, we
370     must commit project files in Visual Studio 6.0 format. Changes
371     should be simple, with minimal compilation and linkage flags that
372     can be recognized by all Visual Studio environments.</p>
373
374   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
375 <div class="section">
376 <h2><a name="installation" id="installation">Installation</a></h2>
377
378     
379
380     <p>Once Apache has been compiled, it needs to be installed in
381     its server root directory. The default is the
382     <code>\Apache2</code> directory, of the same drive.</p>
383
384     <p>To build and install all the files into the desired folder
385     <em>dir</em> automatically, use one of the following
386     <code>nmake</code> commands:</p>
387
388     <div class="example"><p><code>
389       nmake /f Makefile.win installr INSTDIR=<em>dir</em><br />
390       nmake /f Makefile.win installd INSTDIR=<em>dir</em>
391     </code></p></div>
392
393     <p>The <em>dir</em> argument to <code>INSTDIR</code> provides
394     the installation directory; it can be omitted if Apache is
395     to be installed into <code>\Apache22</code> (of the current
396     drive).</p>
397
398   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
399 <div class="section">
400 <h2><a name="projectcomponents-warn" id="projectcomponents-warn">Warning about building Apache from the development tree</a></h2>
401
402     
403
404     <div class="note">Note only the <code>.dsp</code> files are maintained between <code>release</code>
405     builds. The <code>.mak</code> files are NOT regenerated, due to the tremendous
406     waste of reviewer's time. Therefore, you cannot rely on the <code>NMAKE</code>
407     commands above to build revised <code>.dsp</code> project files unless you
408     then export all <code>.mak</code> files yourself from the project. This is
409     unnecessary if you build from within the Microsoft
410     Developer Studio environment.</div>
411
412   </div></div>
413 <div class="bottomlang">
414 <p><span>Available Languages: </span><a href="../en/platform/win_compiling.html" title="English">&nbsp;en&nbsp;</a> |
415 <a href="../ko/platform/win_compiling.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
416 </div><div id="footer">
417 <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>
418 <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>
419 </body></html>