Compiling Apache for Microsoft Windows
Compiling Apache requires the following environment to be properly installed:
Make sure you have at least 200 MB of free disk space available. After installation Apache requires approximately 80 MB of disk space, plus space for log and cache files, which can grow rapidly. The actual disk space requirements will vary considerably based on your chosen configuration and any third-party modules or libraries, especially when OpenSSL is also built. Because many files are text and very easily compressed, NTFS filesystem compression cuts these requirements in half.
The httpd binary is built with the help of several patches to third party packages, which ensure the released code is buildable and debuggable. These patches are available and distributed from http://www.apache.org/dist/httpd/binaries/win32/patches_applied/ and are recommended to be applied to obtain identical results as the "official" ASF distributed binaries.
Microsoft Visual C++ 6.0 (Visual Studio 97) or later.
Apache can be built using the command line tools, or from within the Visual Studio IDE Workbench. The command line build requires the environment to reflect the PATH
and other variables that can be configured with the vcvars32.bat
Updated Microsoft Windows Platform SDK, February 2003 or later.
An appropriate Windows Platform SDK is included by default in the full (not express/lite) versions of Visual C++ 7.1 (Visual Studio 2002) and later, these users can ignore these steps unless explicitly choosing a newer or different version of the Platform SDK.
To use Visual C++ 6.0 or 7.0 (Studio 2000 .NET), the Platform SDK environment must be prepared using the setenv.bat
script (installed by the Platform SDK) before starting the command line build or launching the msdev/devenv GUI environment. Installing the Platform SDK for Visual Studio Express versions (2003 and later) should adjust the default environment appropriately.
"c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32"
Several steps recommended here require a perl interpreter during the build preparation process, but it is otherwise not required.
To install Apache within the build system, several files are modified using the awk.exe
utility. awk was chosen since it is a very small download (compared with Perl or WSH/VB) and accomplishes the task of modifying configuration files upon installation. Brian Kernighan's http://www.cs.princeton.edu/~bwk/btl.mirror/ site has a compiled native Win32 binary, http://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe which you must save with the name awk.exe
(rather than awk95.exe
from the PATH, or executable path specified in the menu option Tools -> Options -> (Projects ->) Directories. Ensure awk.exe is in your system path.gawk.exe
is really a symlink to the gawk.exe
file. The Windows command shell does not recognize symlinks, and because of this building InstallBin will fail. A workaround is to delete awk.exe
from the cygwin installation and copy gawk.exe
. Also note the cygwin/mingw ports of gawk 3.0.x were buggy, please upgrade to 3.1.x before attempting to use any gawk port.[Optional] zlib library (for
. This must be built in-place. Zlib can be obtained from http://www.zlib.net/ -- the
is confirmed to work correctly with version 1.2.3.mod_deflate
nmake -f win32\Makefile.msc
, obtained from http://www.openssl.org/source/, in order to compile
project, which is ab.c with SSL support enabled. To prepare OpenSSL to be linked to Apache mod_ssl or abs.exe, and disable patent encumbered features in OpenSSL, you might use the following build commands:
perl Configure no-rc5 no-idea enable-mdc2 enable-zlib VC-WIN32 -Ipath/to/srclib/zlib -Lpath/to/srclib/zlib
nmake -f ms\ntdll.mak
The apr-util library exposes dbm (keyed database) and dbd (query oriented database) client functionality to the httpd server and its modules, such as authentication and authorization. The sdbm dbm and odbc dbd providers are compiled unconditionally.
The dbd support includes the Oracle instantclient package, MySQL, PostgreSQL and sqlite. To build these all, for example, set up the LIB to include the library path, INCLUDE to include the headers path, and PATH to include the dll bin path of all four SDK's, and set the DBD_LIST environment variable to inform the build which client driver SDKs are installed correctly, e.g.;
set DBD_LIST=sqlite3 pgsql oracle mysql
Similarly, the dbm support can be extended with DBM_LIST to build a Berkeley DB provider (db) and/or gdbm provider, by similarly configuring LIB, INCLUDE and PATH first to ensure the client library libs and headers are available.
See the README-win32.txt file for more hints on obtaining the various database driver SDKs.
The policy of the Apache HTTP Server project is to only release Unix sources. Windows source packages made available for download have been supplied by volunteers and may not be available for every release. You can still build the server on Windows from the Unix source tarball with just a few additional steps.
You can now build the server with the Visual Studio development environment using the IDE. Command-Line builds of the server are not possible from Unix sources unless you export .mak files as explained below.
is the top level Apache makefile. To compile Apache on Windows, simply use one of the following commands to build the release
nmake /f Makefile.win _apacher
Either command will compile Apache. The latter will disable optimization of the resulting files, making it easier to single step the code to find bugs and track down problems.
You can add your apr-util dbd and dbm provider choices with the additional make (environment) variables DBDLIST and DBMLIST, see the comments about [Optional] Database libraries, above. Review the initial comments in Makefile.win for additional options that can be provided when invoking the build.
, is provided. This workspace exposes the entire list of working .dsp
projects that are required for the complete Apache binary release. It includes dependencies between the projects to assure that they are built in the appropriate order.
Open the Apache.dsw
build, as desired) as the Active Project. InstallBin
causes all related project to be built, and then invokes Makefile.win
to move the compiled executables and dlls. You may personalize the INSTDIR=
choice by changing InstallBin
's Settings, General tab, Build command line entry. INSTDIR
defaults to the /Apache2
directory. If you only want a test compile (without installing) you may build the BuildBin
project files are distributed in Visual Studio 6.0 (98) format. Visual C++ 5.0 (97) will recognize them. Visual Studio 2002 (.NET) and later users must convert Apache.dsw
files into an Apache.sln
files. Be sure you reconvert the .msproj
file changes! This is really trivial, just open Apache.dsw
in the VC++ 7.0 IDE once again and reconvert.
perl srclib\apr\build\cvtdsp.pl -2005
Visual Studio 2002 (.NET) and later users should also use the Build menu, Configuration Manager dialog to uncheck both the Debug
components, as well as every component starting with modsslaprdb*
, or the IDE directly with the BinBuild
target, which builds those modules conditionally if the srclib
exist, and based on the setting of DBD_LIST
files pose a greater hassle, but they are required for Visual C++ 5.0 users to build
. The .mak files also support a broader range of C++ tool chain distributions, such as Visual Studio Express.mod_deflate
You must first build all projects in order to create all dynamic auto-generated targets, so that dependencies can be parsed correctly. Build the entire project from within the Visual Studio 6.0 (98) IDE, using the BuildAll
target, then use the Project Menu Export for all makefiles (checking on "with dependencies".) Run the following command to correct absolute paths into relative paths so they will build anywhere:
project file within the current directory and below will be corrected, and the timestamps adjusted to reflect the .dsp
files for Platform SDK or other local, machine specific file paths. The DevStudio\Common\MSDev98\bin\
(VC6) directory contains a sysincl.dat
file, which lists all exceptions. Update this file (including both forward and backslashed paths, such as both sys/time.h
file will cause the build to fail completely.
If you contribute back a patch that revises project files, we must commit project files in Visual Studio 6.0 format. Changes should be simple, with minimal compilation and linkage flags that can be recognized by all Visual Studio environments.
Once Apache has been compiled, it needs to be installed in its server root directory. The default is the \Apache2
directory, of the same drive.
To build and install all the files into the desired folder dir automatically, use one of the following nmake
provides the installation directory; it can be omitted if Apache is to be installed into \Apache22
files are NOT regenerated, due to the tremendous waste of reviewer's time. Therefore, you cannot rely on the NMAKE
files yourself from the project. This is unnecessary if you build from within the Microsoft Developer Studio environment.
Modules | Directives | FAQ | Glossary | Sitemap
Apache HTTP Server Version 2.4
Compiling Apache for Microsoft Windows
Available Languages: en | fr | ko
There are many important points to consider before you begin compiling Apache. See Using Apache with Microsoft Windows before you begin.
- Requirements
- Building from Unix sources
- Command-Line Build
- Developer Studio Workspace IDE Build
- Exporting command-line .mak files
- Installation
- Warning about building Apache from the development tree