Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: HOWTO: Building Apache and dependencies using CMake |
Page Previous 1, 2, 3, 4, 5 |
| Author |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 408 Location: UK
|
Posted: Mon 11 Aug '25 17:04 Post subject: |
|
|
You're keeping me busy...
If you check the LIBXML2 section, you'll see I already specify -DLIBXML2_WITH_ZLIB=ON; indeed this option has been present since I switched to building LIBXML2 using CMake (available since release 2.14.1).
Your other LIBXML2 recommendations are worthy, and I've added them.
Regarding the APR-UTIL version check, there's clearly more than one way to do this. I've always lamented the poor string handling in the Windows shell (having come from a UNIX background). Indeed, I have a DOS version of UNIX find in my Windows path (which therefore takes precedence over the Windows builtin find command), and equally findstr is a pain, partly because its regex handling is poor, but also because it's primarily a file filter. Moreover, in a batch file, for a simple string check do I really have to write something like:
| Code: | echo %APR-UTIL% | findstr /r "1.6.3$" > nul
if %errorlevel% EQU 0 (
...
) |
which is arguably as cryptic as the one liner I've used (clarified with a comment), but then Windows batch file commands are full of idiosyncratic syntax.
But thank you for pointing out the error, which turns out to be a typo in my "if string" test (an extraneous :). It should read:
| Code: | if not x%APR-UTIL:1.6.3=% == x%APR-UTIL% (
...
) |
Regarding the HTTPD 2.4.62 check, I seriously considered removing this section when moving to the 2.4.65 release, but felt it might still be pertinant. I'll revisit this when the next HTTPD release comes out.
In the CURL edit, your request for a single line 'C' comment is somewhat academic, but nonetheless accepted.
A footnote...
This CMake build HowTo is primarily meant to shadow the packages referenced in the official Apache Lounge HTTPD release, and there are comments to this effect across the thread. Thereto, I've chosen to not delete the additional package binaries that get installed into the Apache24 bin directory along the way, e.g. brotli.exe, curl.exe, lua.exe, xmllint.exe, etc., since users may find these of interest. However, building further packages to provide additional functionality (LIBLZMA, LIBPSL, LIBSSH2, NGHTTP3, NGTCP2, ZSTANDARD, PYTHON, etc), is entirely down to individual choice.
I've just seen your further post concerning mod_charset_lite.
| Code: | ...
-- Modules not built:
-- mod_socache_dc
-- mod_charset_lite
... |
When I build HTTPD, this module is compiled and I see following in my output log:
| Code: | -- Looking for APR_HAS_XLATE
-- Looking for APR_HAS_XLATE - found
-- Performing Test APR_HAS_XLATE
-- Performing Test APR_HAS_XLATE - Success <=====
...
-- Modules not built:
-- mod_socache_dc
... |
The HTTPD CMakeLists.txt file includes a macro CHECK_APR_FEATURE, which checks the APR-UTIL header file apu.h for APR_HAS_XLATE, which needs to include:
| Code: | | #define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV |
Can I advise you check your APR-UTIL build code, which should be aware that APR-ICONV has been built and is to be included. The CMake HowTo uses the following code to cover off this requirement:
| Code: | rem Patch CMakelists.txt to support APR-ICONV if we've built it.
rem
if exist "%PREFIX%\lib\libapriconv-1.lib" (
perl -pi.bak -e ^" ^
s~^(SET.+APR_LIBRARIES[\s]+^)(\x22^)(.+libapr^)(-1.lib^)(.+ CACHE^)~${1}${2}${3}${4}${2} ${2}${3}iconv${4}${5}~; ^
s~^(apu_have_apr_iconv_10^) 0~${1} 1~; ^
^" CMakeLists.txt
) |
|
|
| Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 73 Location: Vietnam
|
Posted: Tue 12 Aug '25 5:14 Post subject: |
|
|
| tangent wrote: | | You're keeping me busy... |
I am truly sorry for that.
| Quote: | Can I advise you check your APR-UTIL build code, which should be aware that APR-ICONV has been built and is to be included. The CMake HowTo uses the following code to cover off this requirement:
| Code: | rem Patch CMakelists.txt to support APR-ICONV if we've built it.
rem
if exist "%PREFIX%\lib\libapriconv-1.lib" (
perl -pi.bak -e ^" ^
s~^(SET.+APR_LIBRARIES[\s]+^)(\x22^)(.+libapr^)(-1.lib^)(.+ CACHE^)~${1}${2}${3}${4}${2} ${2}${3}iconv${4}${5}~; ^
s~^(apu_have_apr_iconv_10^) 0~${1} 1~; ^
^" CMakeLists.txt
) |
|
It was my mistake exactly, I used the variable %PREFIX_DIR% instead of %PREFIX%, so the above patched code failed.
I have tried compiling with the latest source code of httpd, apr, and other libraries (except openssl-3.5.1 -> changed to openssl-1.1.1w and pcre2-10.45 changed to pcre-8.45) using VS BuildTools 2019 and confirmed that it has no issues or errors. So you can safely update to the latest version of these packages/libraries.
| Quote: | P/s: I did not update OpenSSL to 3.x because of performance issues. If there is no real need/dependency, I recommend openssl-1.1.1w.
Similarly, with pcre2, there are already big syntax and performance differences between pcre and pcre2, so if you have no real need/dependency (like new/complex regex syntax), I still recommend pcre. Also, pcre is still very well supported with the current version of httpd (2.4.65), it is possible to compile pcre directly without patching. |
|
|
| Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 408 Location: UK
|
Posted: Thu 02 Oct '25 22:11 Post subject: |
|
|
Build dependency updates in support of latest HTTPD 2.4.65 release:
CURL (8.16.0)
EXPAT (2.7.3)
LIBXML2 (2.15.0)
NGHTTP2 (1.67.1)
OPENSSL (3.5.4)
PCRE2 (10.46)
Other than release version changes, remove PCRE2 CMakeLists.txt patch (which is no longer needed), and similarly LIBXML2 CMake configure option LIBXML2_WITH_LZMA. |
|
| Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 408 Location: UK
|
Posted: Tue 09 Dec '25 21:02 Post subject: |
|
|
Build dependency updates in support of latest HTTPD (2.4.66) release:
BROTLI (1.2.0)
CURL (8.17.0)
HTTPD (2.4.66)
LIBXML2 (2.15.1)
NGHTTP2 (1.68.0)
OPENSSL (3.6.0)
PCRE2 (10.47)
There are a significant number of other refinements to the batch file logic in this release (4.1).
Firstly, support for MS Visual Studio 2026 has been added, with an MSVS-SERIES variable being used to choose between locally installed VS2022(17) or VS2026(18). The script currently defaults to VS2022.
Secondly, a CMAKE_DEFAULT_OPTS variable is now passed to all CMake builds. This includes a CMAKE_PREFIX_PATH to ensure we pick up our library builds over others that may be found in the system search path. This change means it's now possible to use later versions of Strawberry Perl, including creating 32-bit builds.
Thirdly, an option has been added to override the CMake minimum version policy; this is needed with VS2026 CMake for some packages (including HTTPD), which currently reference older versions of CMake, e.g. a CMakeLists.txt file entry saying "CMAKE_MINIMUM_REQUIRED(VERSION 2.8)". Note, this new minimum version option may equally cause a "Policy CMP0054" warning message in the log file, which for now is benign.
Similarly, in support of later versions of CMake, the HTTPD CMakeLists.txt file is patched to quote LHS variables in some equality tests. Going forward, a number of packages will evidently need their CMakeLists.txt files updating in future releases, to support later versions of CMake.
Next, PCRE2 CMake options have been added to disable support for BZ2 and READLINE libraries, which may be found (possibly from Strawberry Perl paths).
The CURL url.c file patch has also been reworked for release 8.17.0, and the document build CMakeLists.txt patch has now been lowered from 200 to 20 files per loop.
A patch to HTTPD server\main.c now adds a reference to OpenSSL include file applink.c - see https://docs.openssl.org/3.6/man3/OPENSSL_Applink
Finally, the batch file logic has been revised to exit the whole build process if a package source folder is missing. This wasn't previously the case, and some people may have missed building packages due to folder naming issues. For example, the LibXML2 package download may be named libxml2-v2.15.1.tar.gz (with a 'v') or libxml2-2.15.1.tar.gz (no 'v') depending where you choose to download it from.
I am heartened that Apache Lounge has decided to adopt a CMake approach to building HTTPD packages. |
|
| Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 408 Location: UK
|
Posted: Sun 14 Dec '25 18:06 Post subject: |
|
|
Update build script (release 4.2) to cope with multiple versions of CMake in the search path, as may be the case if later versions of Strawberry Perl are installed, and select the latest version to perform the builds. This should generally be the version bundled with Visual Studio, be that VS2022 or VS2026. Revise common CMake options accordingly.
Also add a patch to CMakeLists.txt files to potentially reposition the PROJECT statement (misplaced in some packages), and update the CMAKE_MINIMUM_REQUIRED version if set to 2.x. Combined, these changes should eliminate the various CMake warning messages that currently occur with some packages, when building with either VS2022 or VS2026. |
|
| Back to top |
|
|
|
|
|
|