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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 This file is generated from xml source: DO NOT EDIT
8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10 <title>Compiling Apache for Microsoft Windows - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body id="manual-page"><div id="page-header">
19 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
20 <p class="apache">Apache HTTP Server Version 2.5</p>
21 <img alt="" src="../images/feather.png" /></div>
22 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
24 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Platform Specific Notes</a></div><div id="page-content"><div id="preamble"><h1>Compiling Apache for Microsoft Windows</h1>
26 <p><span>Available Languages: </span><a href="../en/platform/win_compiling.html" title="English"> en </a> |
27 <a href="../ko/platform/win_compiling.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
31 <p>There are many important points to consider before you begin compiling
32 Apache HTTP Server (httpd). See <a href="windows.html">Using Apache HTTP
33 Server on Microsoft Windows</a> before you begin.</p>
35 <p>httpd can be built on Windows using a cmake-based build system or with
36 Visual Studio project files maintained by httpd developers. The cmake-based
37 build system directly supports more versions of Visual Studio but currently
38 has considerable functional limitations.</p>
41 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#vstudio">Building httpd with the included Visual Studio project files</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#cmake">Building httpd with cmake</a></li>
43 </ul><h3>See also</h3><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
44 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
46 <h2><a name="vstudio" id="vstudio">Building httpd with the included Visual Studio project files</a></h2>
49 <h3><a name="requirements" id="requirements">Requirements</a></h3>
53 <p>Compiling Apache requires the following environment to be
54 properly installed:</p>
60 <p>Make sure you have at least 200 MB of free disk space
61 available. After installation Apache requires approximately
62 80 MB of disk space, plus space for log and cache files,
63 which can grow rapidly. The actual disk space requirements
64 will vary considerably based on your chosen configuration and
65 any third-party modules or libraries, especially when OpenSSL
66 is also built. Because many files are text and very easily
67 compressed, NTFS filesystem compression cuts these requirements
72 <p>Appropriate Patches</p>
74 <p>The httpd binary is built with the help of several patches to
75 third party packages, which ensure the released code is buildable
76 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>
77 and are recommended to be applied to obtain identical results as the
78 "official" ASF distributed binaries.</p>
82 <p>Microsoft Visual C++ 6.0 (Visual Studio 97) or later.</p>
84 <p>Apache can be built using the command line tools, or from
85 within the Visual Studio IDE Workbench. The command line
86 build requires the environment to reflect the <code>PATH</code>,
87 <code>INCLUDE</code>, <code>LIB</code> and other variables
88 that can be configured with the <code>vcvars32.bat</code> script.</p>
90 <div class="note">You may want the Visual Studio Processor Pack for your older
91 version of Visual Studio, or a full (not Express) version of newer
92 Visual Studio editions, for the ml.exe assembler. This will allow
93 you to build OpenSSL, if desired, using the more efficient assembly
94 code implementation.</div>
96 <div class="note">Only the Microsoft compiler tool chain is actively supported by
97 the active httpd contributors. Although the project regularly accepts
98 patches to ensure MinGW and other alternative builds work and improve
99 upon them, they are not actively maintained and are often broken in
100 the course of normal development.</div>
104 <p>Updated Microsoft Windows Platform SDK, February 2003 or later.</p>
106 <p>An appropriate Windows Platform SDK is included by default in the
107 full (not express/lite) versions of Visual C++ 7.1 (Visual Studio 2002)
108 and later, these users can ignore these steps unless explicitly choosing
109 a newer or different version of the Platform SDK.</p>
111 <p>To use Visual C++ 6.0 or 7.0 (Studio 2000 .NET), the Platform SDK
112 environment must be prepared using the <code>setenv.bat</code>
113 script (installed by the Platform SDK) before starting the command
114 line build or launching the msdev/devenv GUI environment. Installing
115 the Platform SDK for Visual Studio Express versions (2003 and later)
116 should adjust the default environment appropriately.</p>
118 <div class="example"><p><code>
119 "c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32"<br />
120 "c:\Program Files\Platform SDK\setenv.bat"
127 <p>Several steps recommended here require a perl interpreter during
128 the build preparation process, but it is otherwise not required.</p>
130 <p>To install Apache within the build system, several files are
131 modified using the <code>awk.exe</code> utility. awk was chosen since
132 it is a very small download (compared with Perl or WSH/VB) and
133 accomplishes the task of modifying configuration files upon
134 installation. Brian Kernighan's
135 <a href="http://www.cs.princeton.edu/~bwk/btl.mirror/">http://www.cs.princeton.edu/~bwk/btl.mirror/</a>
136 site has a compiled native Win32 binary,
137 <a href="http://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe">http://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe</a> which
138 you must save with the name <code>awk.exe</code> (rather than
139 <code>awk95.exe</code>).</p>
141 <div class="note">If awk.exe is not found, Makefile.win's install target
142 will not perform substitutions in the installed .conf files.
143 You must manually modify the installed .conf files to allow
144 the server to start. Search and replace all "@token@" tags
145 as appropriate.</div>
147 <div class="note">The Visual Studio IDE will only find <code>awk.exe</code>
148 from the PATH, or executable path specified in the menu option
149 Tools -> Options -> (Projects ->) Directories. Ensure
150 awk.exe is in your system path.</div>
152 <div class="note">Also note that if you are using Cygwin tools
153 (<a href="http://www.cygwin.com/">http://www.cygwin.com/</a>)
154 the awk utility is named <code>gawk.exe</code> and that the file
155 <code>awk.exe</code> is really a symlink to the <code>gawk.exe</code>
156 file. The Windows command shell does not recognize symlinks, and
157 because of this building InstallBin will fail. A workaround is
158 to delete <code>awk.exe</code> from the cygwin installation and
159 copy <code>gawk.exe</code> to <code>awk.exe</code>. Also note the
160 cygwin/mingw ports of gawk 3.0.x were buggy, please upgrade to 3.1.x
161 before attempting to use any gawk port.</div>
165 <p>[Optional] zlib library (for <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>)</p>
167 <p>Zlib must be installed into a <code>srclib</code> subdirectory named
168 <code>zlib</code>. This must be built in-place. Zlib can be obtained
169 from <a href="http://www.zlib.net/">http://www.zlib.net/</a> -- the
170 <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code> is confirmed to work correctly with
173 <div class="example"><p><code>
174 nmake -f win32\Makefile.msc<br />
175 nmake -f win32\Makefile.msc test
180 <p>[Optional] OpenSSL libraries (for <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>
181 and <code>ab.exe</code> with ssl support)</p>
183 <div class="note">The OpenSSL library is cryptographic software. The country
184 in which you currently reside may have restrictions on the import,
185 possession, use, and/or re-export to another country, of encryption
186 software. BEFORE using any encryption software, please check your
187 country's laws, regulations and policies concerning the import,
188 possession, or use, and re-export of encryption software, to see
189 if this is permitted. See
190 <a href="http://www.wassenaar.org/">http://www.wassenaar.org/</a>
191 for more information.</div>
193 <p>Configuring and building OpenSSL requires perl to be installed.</p>
195 <p>OpenSSL must be installed into a <code>srclib</code> subdirectory
196 named <code>openssl</code>, obtained from
197 <a href="http://www.openssl.org/source/">http://www.openssl.org/source/</a>, in order to compile
198 <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> or the <code>abs.exe</code> project, which
199 is ab.c with SSL support enabled. To prepare OpenSSL to be linked
200 to Apache mod_ssl or abs.exe, and disable patent encumbered features
201 in OpenSSL, you might use the following build commands:</p>
203 <div class="example"><p><code>
204 perl Configure no-rc5 no-idea enable-mdc2 enable-zlib VC-WIN32
205 -Ipath/to/srclib/zlib -Lpath/to/srclib/zlib<br />
207 nmake -f ms\ntdll.mak
210 <div class="note">It is not advisable to use zlib-dynamic, as that transfers
211 the cost of deflating SSL streams to the first request which must
212 load the zlib dll. Note the suggested patch enables the -L flag to
213 work with windows builds, corrects the name of zdll.lib and ensures
214 .pdb files are generated for troubleshooting. If the assembler is
215 not installed, you would add no-asm above and use ms\do_ms.bat
216 instead of the ms\do_masm.bat script.</div>
220 <p>[Optional] Database libraries (for <code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code>
221 and <code class="module"><a href="../mod/mod_authn_dbm.html">mod_authn_dbm</a></code>)</p>
223 <p>The apr-util library exposes dbm (keyed database) and dbd (query
224 oriented database) client functionality to the httpd server and its
225 modules, such as authentication and authorization. The sdbm dbm and
226 odbc dbd providers are compiled unconditionally.</p>
228 <p>The dbd support includes the Oracle instantclient package, MySQL,
229 PostgreSQL and sqlite. To build these all, for example, set up the
230 LIB to include the library path, INCLUDE to include the headers path,
231 and PATH to include the dll bin path of all four SDK's, and set the
232 DBD_LIST environment variable to inform the build which client driver
233 SDKs are installed correctly, e.g.;</p>
235 <div class="example"><p><code>
236 set DBD_LIST=sqlite3 pgsql oracle mysql
239 <p>Similarly, the dbm support can be extended with DBM_LIST to
240 build a Berkeley DB provider (db) and/or gdbm provider, by similarly
241 configuring LIB, INCLUDE and PATH first to ensure the client library
242 libs and headers are available.</p>
244 <div class="example"><p><code>
248 <div class="note">Depending on the choice of database distributions, it may be
249 necessary to change the actual link target name (e.g. gdbm.lib vs.
250 libgdb.lib) that are listed in the corresponding .dsp/.mak files
251 within the directories srclib\apr-util\dbd or ...\dbm.</div>
253 <p>See the README-win32.txt file for more hints on obtaining the
254 various database driver SDKs.</p>
260 <h3><a name="unixsrcbuild" id="unixsrcbuild">Building from Unix sources</a></h3>
264 <p>The policy of the Apache HTTP Server project is to only release Unix sources.
265 Windows source packages made available for download have been supplied by
266 volunteers and may not be available for every release. You can still build
267 the server on Windows from the Unix source tarball with just a few additional
271 <li>Download and unpack the Unix source tarball for the latest version.</li>
272 <li>Download and unpack the Unix source tarball for latest version of
273 APR, AR-Util and APR-Iconv, place these sources in directories httpd-2.x.x\srclib\apr, httpd-2.x.x\srclib\apr-util and httpd-2.x.x\srclib\apr-iconv</li>
274 <li>Open a Command Prompt and CD to the httpd-2.x.x folder</li>
275 <li>Run the line endings conversion utility at the prompt;</li>
278 <div class="example"><p><code>
279 perl srclib\apr\build\lineends.pl
282 <p>You can now build the server with the Visual Studio 6.0 development
283 environment using the IDE. Command-Line builds of the server are not
284 possible from Unix sources unless you export .mak files as explained
290 <h3><a name="commandbuild" id="commandbuild">Command-Line Build</a></h3>
294 <p><code>Makefile.win</code> is the top level Apache makefile.
295 To compile Apache on Windows, simply use one of the following commands
296 to build the <code>release</code> or <code>debug</code> flavor:</p>
298 <div class="example"><p><code>
299 nmake /f Makefile.win _apacher<br /><br />
300 nmake /f Makefile.win _apached
303 <p>Either command will compile Apache. The latter will disable
304 optimization of the resulting files, making it easier to single
305 step the code to find bugs and track down problems.</p>
307 <p>You can add your apr-util dbd and dbm provider choices with the
308 additional make (environment) variables DBD_LIST and DBM_LIST,
309 see the comments about [Optional] Database libraries, above.
310 Review the initial comments in Makefile.win for additional options
311 that can be provided when invoking the build.</p>
315 <h3><a name="workspacebuild" id="workspacebuild">Developer Studio Workspace IDE Build</a></h3>
319 <p>Apache can also be compiled using VC++'s Visual Studio
320 development environment. To simplify this process, a
321 Visual Studio workspace, <code>Apache.dsw</code>, is provided.
322 This workspace exposes the entire list of working <code>.dsp</code>
323 projects that are required for the complete Apache binary release.
324 It includes dependencies between the projects to assure that they
325 are built in the appropriate order.</p>
327 <p>Open the <code>Apache.dsw</code> workspace, and select
328 <code>InstallBin</code> (<code>Release</code> or <code>Debug</code> build,
329 as desired) as the Active Project. <code>InstallBin</code> causes all
330 related project to be built, and then invokes <code>Makefile.win</code> to
331 move the compiled executables and dlls. You may personalize the
332 <code>INSTDIR=</code> choice by changing <code>InstallBin</code>'s Settings,
333 General tab, Build command line entry. <code>INSTDIR</code> defaults to the
334 <code>/Apache2</code> directory. If you only want a test compile (without
335 installing) you may build the <code>BuildBin</code> project instead.</p>
337 <p>The <code>.dsp</code> project files are distributed in Visual Studio 6.0
338 (98) format. Visual C++ 5.0 (97) will recognize them. Visual Studio
339 2002 (.NET) and later users must convert <code>Apache.dsw</code> plus
340 the <code>.dsp</code> files into an <code>Apache.sln</code> plus
341 <code>.msproj</code> files. Be sure you reconvert the <code>.msproj</code>
342 file again if its source <code>.dsp</code> file changes! This is really
343 trivial, just open <code>Apache.dsw</code> in the VC++ 7.0 IDE once again
346 <div class="note">There is a flaw in the .vcproj conversion of .dsp files. devenv.exe
347 will mis-parse the /D flag for RC flags containing long quoted /D'efines
348 which contain spaces. The command:
349 <div class="example"><p><code>
350 perl srclib\apr\build\cvtdsp.pl -2005
352 will convert the /D flags for RC flags to use an alternate, parseable
353 syntax; unfortunately this syntax isn't supported by Visual Studio 97
354 or its exported .mak files. These /D flags are used to pass the long
355 description of the mod_apachemodule.so files to the shared .rc resource
356 version-identifier build.</div>
358 <p>Visual Studio 2002 (.NET) and later users should also use the Build
359 menu, Configuration Manager dialog to uncheck both the <code>Debug</code>
360 and <code>Release</code> Solution modules <code>abs</code>,
361 <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
362 well as every component starting with <code>apr_db*</code>. These modules
363 are built by invoking <code>nmake</code>, or the IDE directly with the
364 <code>BinBuild</code> target, which builds those modules conditionally
365 if the <code>srclib</code> directories <code>openssl</code> and/or
366 <code>zlib</code> exist, and based on the setting of <code>DBD_LIST</code>
367 and <code>DBM_LIST</code> environment variables.</p>
371 <h3><a name="exportingmakfiles" id="exportingmakfiles">Exporting command-line .mak files</a></h3>
375 <p>Exported <code>.mak</code> files pose a greater hassle, but they are
376 required for Visual C++ 5.0 users to build <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>,
377 abs (<code class="program"><a href="../programs/ab.html">ab</a></code> with SSL support) and/or
378 <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. The .mak files also support a broader
379 range of C++ tool chain distributions, such as Visual Studio Express.</p>
381 <p>You must first build all projects in order to create all dynamic
382 auto-generated targets, so that dependencies can be parsed correctly.
383 Build the entire project from within the Visual Studio 6.0 (98) IDE,
384 using the <code>BuildAll</code> target, then use the Project Menu Export
385 for all makefiles (checking on "with dependencies".) Run the following
386 command to correct absolute paths into relative paths so they will build
389 <div class="example"><p><code>
390 perl srclib\apr\build\fixwin32mak.pl
393 <p>You must type this command from the <em>top level</em>
394 directory of the httpd source tree. Every
395 <code>.mak</code> and <code>.dep</code> project file within
396 the current directory and below will be corrected, and the
397 timestamps adjusted to reflect the <code>.dsp</code>.</p>
399 <p>Always review the generated <code>.mak</code> and <code>.dep</code>
400 files for Platform SDK or other local, machine specific file paths.
401 The <code>DevStudio\Common\MSDev98\bin\</code> (VC6) directory contains
402 a <code>sysincl.dat</code> file, which lists all exceptions. Update
403 this file (including both forward and backslashed paths, such as both
404 <code>sys/time.h</code> and <code>sys\time.h</code>) to ignore such
405 newer dependencies. Including local-install paths in a distributed
406 <code>.mak</code> file will cause the build to fail completely.</p>
408 <p>If you contribute back a patch that revises project files, we
409 must commit project files in Visual Studio 6.0 format. Changes
410 should be simple, with minimal compilation and linkage flags that
411 can be recognized by all Visual Studio environments.</p>
415 <h3><a name="installation" id="installation">Installation</a></h3>
419 <p>Once Apache has been compiled, it needs to be installed in
420 its server root directory. The default is the
421 <code>\Apache2</code> directory, of the same drive.</p>
423 <p>To build and install all the files into the desired folder
424 <em>dir</em> automatically, use one of the following
425 <code>nmake</code> commands:</p>
427 <div class="example"><p><code>
428 nmake /f Makefile.win installr INSTDIR=<em>dir</em><br />
429 nmake /f Makefile.win installd INSTDIR=<em>dir</em>
432 <p>The <em>dir</em> argument to <code>INSTDIR</code> provides
433 the installation directory; it can be omitted if Apache is
434 to be installed into <code>\Apache22</code> (of the current
439 <h3><a name="projectcomponents-warn" id="projectcomponents-warn">Warning about building Apache from the development tree</a></h3>
443 <div class="note">Note only the <code>.dsp</code> files are maintained between <code>release</code>
444 builds. The <code>.mak</code> files are NOT regenerated, due to the tremendous
445 waste of reviewer's time. Therefore, you cannot rely on the <code>NMAKE</code>
446 commands above to build revised <code>.dsp</code> project files unless you
447 then export all <code>.mak</code> files yourself from the project. This is
448 unnecessary if you build from within the Microsoft
449 Developer Studio environment.</div>
452 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
453 <div class="section">
454 <h2><a name="cmake" id="cmake">Building httpd with cmake</a></h2>
457 <p>The primary documentation for this build mechanism is in the
458 <code>README.cmake</code> file in the source distribution. Refer to that file
459 for detailed instructions.</p>
461 <p>Building httpd with cmake requires building APR and APR-util separately.
462 Refer to their <code>README.cmake</code> files for instructions.</p>
464 <p>The primary limitations of the cmake-based build are inherited from the APR-util
465 project, and are listed below because of their impact on httpd:</p>
468 <li>No cmake build for the APR-iconv subproject is available, and the
469 APR-util cmake build cannot consume an existing APR-iconv build. Thus,
470 <code class="module"><a href="../mod/mod_charset_lite.html">mod_charset_lite</a></code> and possibly some third-party modules
472 <li>The cmake build for the APR-util subproject does not support most of the
473 optional DBM and DBD libraries supported by the included Visual Studio
474 project files. This limits the database backends supported by a number of
475 bundled and third-party modules.</li>
479 <div class="bottomlang">
480 <p><span>Available Languages: </span><a href="../en/platform/win_compiling.html" title="English"> en </a> |
481 <a href="../ko/platform/win_compiling.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
482 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
483 <script type="text/javascript"><!--//--><![CDATA[//><!--
484 var comments_shortname = 'httpd';
485 var comments_identifier = 'http://httpd.apache.org/docs/trunk/platform/win_compiling.html';
487 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
488 d.write('<div id="comments_thread"><\/div>');
489 var s = d.createElement('script');
490 s.type = 'text/javascript';
492 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
493 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
496 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
498 })(window, document);
499 //--><!]]></script></div><div id="footer">
500 <p class="apache">Copyright 2017 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>
501 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
502 if (typeof(prettyPrint) !== 'undefined') {