1 Experimental cmake-based build support for Apache httpd on Microsoft Windows
6 This build support is currently intended only for Microsoft Windows.
8 This build support is experimental. Specifically,
10 * It does not support all features of Apache httpd.
11 * Some components may not be built correctly and/or in a manner
12 compatible with the previous Windows build support.
13 * Build interfaces, such as the mechanisms which are used to enable
14 optional functionality or specify prerequisites, may change from
15 release to release as feedback is received from users and bugs and
16 limitations are resolved.
18 Important: Refer to the "Known Bugs and Limitations" section for further
21 It is beyond the scope of this document to document or explain
22 how to utilize the various cmake features, such as different
23 build backends or provisions for finding support libraries.
25 Please refer to the cmake documentation for additional information
26 that applies to building any project with cmake.
31 The following tools must be in PATH:
33 * cmake, version 2.8 or later
34 cmake version 3.1.3 or later is required to work with current OpenSSL
35 releases. (OpenSSL is an optional prerequisite of httpd.)
37 * If the WITH_MODULES feature is used: awk
38 * If using a command-line compiler: compiler and linker and related tools
39 (Refer to the cmake documentation for more information.)
41 The following support libraries are mandatory:
43 * APR, built with cmake
44 + Either APR 2.0-dev (trunk) or APR 1.5.x and APR-Util 1.5.x.
45 + When building APR (but not APR-Util), specify the build option
46 APR_INSTALL_PRIVATE_H so that non-standard files required for building
47 Apache httpd are installed.
48 + Additional APR settings affect httpd but are not mandatory, such as
50 * PCRE (version 6.7 or higher)
52 Certain optional features of APR 2.0-dev (trunk) or APR-Util 1.5.x
53 allow some optional features of httpd to be enabled. For example,
54 APU_HAVE_CRYPTO is required for mod_session_crypto.
56 Additional support libraries allow some optional features of httpd to be
59 * libxml2 (e.g., mod_proxy_html)
62 * openssl (mod_ssl and https support for ab)
68 If you have a binary install of OpenSSL in a well-known directory (e.g.,
69 %HOME%\OpenSSL-Win64) and you wish to build httpd against a different
70 install of OpenSSL, the cmake build may unexpectedly select OpenSSL
71 libraries in the well-known directory even if the expected include files
72 are used. Check the cmake output from your httpd build to confirm that
73 the expected OpenSSL libraries and include files are used.
75 The cmake FindOpenSSL module searches for OpenSSL libraries in a "VC"
76 subdirectory of the OpenSSL install with filenames that indicate the build
77 type (e.g., "<PREFIX>/lib/VC/ssleay32MD.lib"); defining CMAKE_PREFIX_PATH
78 or OPENSSL_ROOT_DIR or even OPENSSL_LIBRARIES does not circumvent finding
81 To work around this issue, rename the well-known OpenSSL directory while
82 building httpd. Let us know if you find a better solution.
87 This is required for mod_http2.
89 cmake-based build support for nghttp2 for Windows can be found at
90 https://github.com/trawick/nghttp2-minimal-cmake. That easily fits into
91 a build system that already uses cmake for httpd, apr, and perhaps other
92 packages. A dynamic build of nghttp2 using its normal Windows build
93 system should also be usable by nghttp2.
98 1. cd to a clean directory for building (i.e., don't build in your
101 2. Make sure cmake and Perl are in PATH. Additionally, some backends
102 require compile tools in PATH. (Hint: "Visual Studio Command Prompt")
103 In the unlikely event that you use -DWITH_MODULES, described below, make
106 3. cmake -G "some backend, like 'NMake Makefiles'"
107 -DCMAKE_INSTALL_PREFIX=d:/path/to/httpdinst
108 -DENABLE_foo=A|I|O|a|i
109 -DENABLE_MODULES=A|I|O|a|i
110 d:/path/to/httpdsource
112 Alternately, you can use the cmake-gui and update settings in the GUI.
114 PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES,
115 NGHTTP2_INCLUDE_DIR, NGHTTP2_LIBRARIES:
117 cmake doesn't bundle FindXXX for these packages, so the crucial
118 information has to be specified in this manner if they aren't found
119 in their default location.
121 -DPCRE_INCLUDE_DIR=d:/path/to/pcreinst/include
122 -DPCRE_LIBRARIES=d:/path/to/pcreinst/lib/pcre[d].lib
124 These will have to be specified only if PCRE is installed to a different
125 directory than httpd, or if debug *and* release builds of PCRE were
126 installed there and you want to control which is used. (Currently the
127 build will use pcred.lib (debug) if it is found in the default location
128 and not overridden with -DPCRE_LIBRARIES.)
130 -DAPR_INCLUDE_DIR=d:/path/to/aprinst/include
131 -DAPR_LIBRARIES="d:/path/to/aprinst/lib/libapr-1.lib;d:/path/to/aprinst/lib/libaprutil-1.lib"
133 These will have to be specified if APR[-Util] was installed to a
134 different directory than httpd.
136 When building with APR trunk (future APR 2.x, with integrated APR-Util),
137 specify just the path to libapr-2.lib:
139 -DAPR_LIBRARIES=d:/path/to/aprinst/lib/libapr-2.lib
141 APR+APR-Util 1.x vs. APR trunk will be detected automatically if they
142 are installed to the same location as httpd.
144 APR-Util 1.x has an optional LDAP library. If APR-Util has LDAP enabled
145 and httpd's mod_ldap and mod_authnz_ldap are being used, include the
146 path to the LDAP library in the APR_LIBRARIES setting. (If APR and
147 APR-Util are found in the default location, the LDAP library will be
148 included if it is present.
150 -DNGHTTP2_INCLUDE_DIR=d:/path/to/nghttp2inst/include (which has nghttp2/*.h)
151 -DNGHTTP2_LIBRARIES=d:/path/to/nghttp2inst/lib/nghttp2.lib"
153 These will have to be specified if nghttp2 was installed to a different
154 directory than httpd.
156 LIBXML2_ICONV_INCLUDE_DIR, LIBXML2_ICONV_LIBRARIES
158 If using a module that requires libxml2 *and* the build of libxml2 requires
159 iconv, set these variables to allow iconv includes and libraries to be
162 -DLIBXML2_ICONV_INCLUDE_DIR=c:\iconv-1.9.2.win32\include
163 -DLIBXML2_ICONV_LIBRARIES=c:\iconv-1.9.2.win32\lib\iconv.lib
165 CMAKE_C_FLAGS_RELEASE, _DEBUG, _RELWITHDEBINFO, _MINSIZEREL
168 For NMake Makefiles the choices are at least DEBUG, RELEASE,
169 RELWITHDEBINFO, and MINSIZEREL
170 Other backends may have other selections.
174 Each module has a default setting which can be overridden with one of
175 the following values:
176 A build and Activate module
177 a build and Activate module IFF prereqs are available; if
178 prereqs are unavailable, don't build it
179 I build module but leave it Inactive (commented-out
180 LoadModule directive)
181 i build module but leave it Inactive IFF prereqs are
182 available; if prereqs are unavailable, don't build it
183 O Omit module completely
185 Examples: -DENABLE_ACCESS_COMPAT=O
186 -DENABLE_PROXY_HTML=i
190 This changes the *minimum* enablement of all modules to the specified
191 value (one of A, a, I, i, O, as described under ENABLE_foo above).
193 The ranking of enablement from lowest to highest is O, i, I, a, A.
194 If a specific module has a higher rank enablement setting, either from
195 a built-in default or from -DENABLE_foo, ENABLE_MODULES won't affect
196 that module. However, if a specific module has a lower-rank enablement
197 setting, presumably from a built-in default, the value of ENABLE_MODULES
198 will be used for that module.
200 Explanations for possible values:
202 -DENABLE_MODULES=a build and activate all possible modules,
203 ignoring any with missing prereqs
204 (doesn't affect modules with A for ENABLE_foo)
206 -DENABLE_MODULES=i build but leave inactive all possible
207 modules, ignoring any with missing
209 (doesn't affect modules with A, a, or I for
212 -DENABLE_MODULES=O no impact, since all modules are either
213 already disabled or have a higher setting
215 -DENABLE_MODULES=A build and activate all possible modules,
216 failing the build if any module is missing
219 -DENABLE_MODULES=I similar to -DENABLE_MODULES=A
220 (doesn't affect modules with A or a for
225 Comma-separated paths to single file modules to statically linked into
226 the server, like the --with-module=modpath:/path/to/mod_foo.c with
227 the autoconf-based build. Key differences: The modpath (e.g.,
228 "generators") isn't provided or used, and the copy of the module
229 source being built is automatically updated when it changes.
230 See also EXTRA_COMPILE_FLAGS, EXTRA_INCLUDES, and EXTRA_LIBS.
234 Space-delimited compile flags to define with the build.
238 List of additional directories to search for .h files. This may
239 be necessary when including third-party modules in the httpd build
244 List of additional libraries to link with. This may be necessary when
245 including third-party modules in the httpd build via WITH_MODULES.
249 Port numbers for substitution into default .conf files. (The defaults
254 If .pdb files are generated for debugging, install them.
257 The .pdb files are generally needed for debugging low-level code
258 problems. If they aren't installed, they are still available in the
259 build directory for use by alternate packaging implementations or when
260 debugging on the build machine.
264 Install the Apache HTTP Server manual.
267 This could be turned off when developing changes in order to speed up
270 4. Build using the chosen generator (e.g., "nmake install" for cmake's "NMake
271 Makefiles" generator).
273 Running the server and support programs
274 ---------------------------------------
276 This build system does not copy binaries such as dlls from other projects
277 into the httpd install location. Without taking some precautions, httpd
278 and support programs can fail to start or modules can fail to load because
279 a support library can't be found in PATH or in the directory of the httpd
282 This can be resolved in several different ways:
284 * Install httpd and the various support libraries to a common install
285 prefix so that support libraries and httpd programs are installed in
286 the same bin directory and are found without setting PATH.
288 * Update PATH to include the bin directories of all necessary support
291 Depending on where PATH is set, it may not affect starting httpd as
294 * Maintain a script which combines required binaries into a common
295 location, such as the httpd installion bin directory, and use that
296 script after building or otherwise installing or updating support
299 * AVOID THE USE of any unrepeatable process of copying dll files around
300 from different install locations until something starts working. The
301 result is that when you later update a support library to pick up a
302 security fix, httpd will likely continue to use the old, vulnerable
305 Known Bugs and Limitations
306 --------------------------
308 * no standard script or makefile is provided to tie together the builds
309 of httpd and support libraries in a manner suitable for typical users
310 * no logic to find support libraries or otherwise build these modules:
311 + mod_socache_dc (requires distcache), mod_serf (requires serf)
312 + additionally, mod_lbmethod_rr and mod_firehose don't compile on Windows
314 * buildmark.c isn't necessarily rebuilt when httpd.exe is regenerated
315 * ApacheMonitor has a build error and is disabled
316 * CGI examples aren't installed
317 * dbmmanage.pl and wintty aren't built/installed
318 * module enablement defaults are not in sync with the autoconf-based build
319 * no support for static support library builds; unclear if that is a
320 requirement; if so: taking PCRE as an example, we'd need to detect that it
321 is static and then turn on PCRE_STATIC for the libhttpd build
325 * Many httpd features have not been tested with this build.
326 * Developers need to examine the existing Windows build in great detail and see
327 what is missing from the cmake-based build, whether a feature or some build
329 * Any feedback you can provide on your experiences with this build will be