logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> How-to's & Documentation & Tips View previous topic :: View next topic
Reply to topic   Topic: HOWTO: Building Apache 2.4.x for Windows x64 using CMake
Author
idblew



Joined: 14 Nov 2014
Posts: 10
Location: Melbourne, Australia

PostPosted: Fri 27 Mar '15 2:40    Post subject: HOWTO: Building Apache 2.4.x for Windows x64 using CMake Reply with quote

An updated version you can find at https://www.apachelounge.com/viewtopic.php?p=39755


Having struggled to get a build working using the Visual Studio 2013 IDE, and not wanting to rely on the WIN32 sources kindly provided by Gregg, I set about defining a process which worked using stock source packages and with minimal fuss.

Please see below the process I now use, based on the efforts of WangMaster in http://www.apachelounge.com/viewtopic.php?t=6421

Software Requirements:
    Visual Studio 2013 (I use the Community Edition)
    ActivePerl for Windows (64-bit, currently using 5.20.1.2000)
    CMake for Windows (currently using 3.1.3)
    GNU Awk for Windows (currently using 3.1.6-1)
    Netwide Assembler (NASM) (currently using 2.11.06)

Source Code Packages (I don't use ZLIB for Apache or OpenSSL, or LUA/LIBXML2/EXPAT, therefore these are not included in the process):
    httpd-2.4.12.tar.gz
    apr-1.5.1.tar.gz
    apr-util.1.5.4.tar.gz
    openssl-1.0.2a.tar.gz (yes it works with 1.0.2a!)
    pcre-8.36.tar.gz

Process:
  1. Extract all packages into their separate folders in your preferred source tree (e.g. C:\Development\Apache24\src)

  2. Create custom build folders for Apache, PCRE, APR and APR-Util in your preferred build folder (e.g. C:\Development\Apache24\build)

  3. Your folder structure should resemble the below:

    Code:
    C:\Development
       └ Apache24
          ├ src
          │   ├ apr-1.5.1
          │   ├ apr-util-1.5.4
          │   ├ httpd-2.4.12
          │   ├ openssl-1.0.2a
          │   └ pcre-8.36
          │
          └ build
             ├ apr
             ├ apr-util
             ├ httpd
             └ pcre


  4. Make the following file changes so that ApacheMonitor gets built (without the Manifest error):

      C:\Development\Apache24\src\httpd-2.4.12\CMakeLists.txt
      Uncomment the section to build the ApacheMonitor utility (lines 769-775)
      Code:
      # getting duplicate manifest error with ApacheMonitor
      ADD_EXECUTABLE(ApacheMonitor support/win32/ApacheMonitor.c support/win32/ApacheMonitor.rc)
      SET(install_targets ${install_targets} ApacheMonitor)
      SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/ApacheMonitor.pdb)
      SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES WIN32_EXECUTABLE TRUE)
      SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=ApacheMonitor -DBIN_NAME=ApacheMonitor.exe / ${EXTRA_COMPILE_FLAGS}")
      TARGET_LINK_LIBRARIES(ApacheMonitor ${EXTRA_LIBS} ${HTTPD_SYSTEM_LIBS} comctl32 wtsapi32)

      C:\Development\Apache24\src\httpd-2.4.12\support\win32\ApacheMonitor.rc
      Comment out the line that includes ApacheMonitor.manifest (line 29)
      Code:
      //CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST  "ApacheMonitor.manifest"



  5. From the Start menu, launch the VS2013 x64 Native Tools Command Prompt found under Visual Studio 2013->Visual Studio Tools. Alternatively from a Windows Command Prompt run the following command:

    Code:
    call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64


  6. Navigate into the build sub-folder for PCRE, run CMAKE to generate a suitable Makefile, then compile and install

    Code:
    cd /D C:\Development\Apache24\build\pcre
    cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Apache24 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON -DPCRE_BUILD_TESTS=OFF -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_SUPPORT_PCREGREP_JIT=OFF -DPCRE_SUPPORT_UTF=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DPCRE_NEWLINE=CRLF -DINSTALL_MSVC_PDB=OFF ..\..\src\pcre-8.36
    nmake
    nmake install


  7. Navigate into the source sub-folder for OpenSSL, configure the build environment for compiling with NASM, then compile and install

    Code:
    cd /D C:\Development\Apache24\src\openssl-1.0.2a
    perl Configure VC-WIN64A --prefix=C:\Apache24 --openssldir=C:\Apache24\conf enable-camellia no-idea no-mdc2 no-ssl2 no-ssl3 no-zlib
    ms\do_win64a.bat
    nmake /f ms\ntdll.mak
    nmake /f ms\ntdll.mak install


  8. Navigate into the build sub-folder for APR, run CMAKE to generate a suitable Makefile, then compile and install

    Code:
    cd /D C:\Development\Apache24\build\apr
    cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Apache24 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMIN_WINDOWS_VER=0x0600 -DAPR_HAVE_IPV6=ON -DAPR_INSTALL_PRIVATE_H=ON -DAPR_BUILD_TESTAPR=OFF -DINSTALL_PDB=OFF ..\..\src\apr-1.5.1
    nmake
    nmake install


  9. Navigate into the build sub-folder for APR-Util, run CMAKE to generate a suitable Makefile, then compile and install

    Code:
    cd /D C:\Development\Apache24\build\apr-util
    cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Apache24 -DOPENSSL_ROOT_DIR=C:\Apache24 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DAPU_HAVE_CRYPTO=ON -DAPR_BUILD_TESTAPR=OFF -DINSTALL_PDB=OFF ..\..\src\apr-util-1.5.4
    nmake
    nmake install


  10. Navigate into the build sub-folder for Apache, run CMAKE to generate a suitable Makefile, then compile and install

    Code:
    cd /D C:\Development\Apache24\build\httpd
    cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Apache24 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_MODULES=i -DINSTALL_PDB=OFF ..\..\src\httpd-2.4.12
    nmake
    nmake install


  11. Finally, confirm everything is working

    Code:
    cd /D C:\Apache24\bin
    openssl version
    httpd -V


I hope that others who have struggled find this useful. Please feel free to suggest any improvements to the process.

Ian
Back to top
idblew



Joined: 14 Nov 2014
Posts: 10
Location: Melbourne, Australia

PostPosted: Fri 27 Mar '15 9:53    Post subject: Reply with quote

If you also require the various text files in the folder C:\Apache24 for completeness, bearing in mind the CMAKE routine omits these, you can use the following batch file (currently only supports OpenSSL and PCRE).

Code:
@ECHO OFF

set INSTALLDIR=C:\Apache24
set SRCDIR=C:\Development\Apache24\src
echo.

:: Get Apache Version
for /f "tokens=5" %%a in ('%INSTALLDIR%\bin\httpd -v ^| find "version"') do ( set APACHEVER=%%a )
for /f "tokens=2 delims=^/" %%a in ('echo %APACHEVER:~0,-1%') do ( set APACHEVER=%%a )
set APACHEVER=%APACHEVER:~0,-1%
echo Apache Version: %APACHEVER%

:: Get OpenSSL Version
for /f "tokens=2" %%a in ('%INSTALLDIR%\bin\openssl version') do ( SET OPENSSLVER=%%a )
set OPENSSLVER=%OPENSSLVER:~0,-1%
echo OpenSSL Version: %OPENSSLVER%

:: Get PCRE Version
for /f "tokens=3" %%a in ('findstr PCRE_MAJOR %INSTALLDIR%\include\pcre.h') do ( SET PCREMAJORVER=%%a )
for /f "tokens=3" %%a in ('findstr PCRE_MINOR %INSTALLDIR%\include\pcre.h') do ( SET PCREMINORVER=%%a )
set PCREVER=%PCREMAJORVER:~0,-1%.%PCREMINORVER:~0,-1%
echo PCRE Version: %PCREVER%

echo.

:: Copy ABOUT_APACHE.txt
echo ABOUT_APACHE.txt
copy %SRCDIR%\httpd-%APACHEVER%\ABOUT_APACHE %INSTALLDIR%\ABOUT_APACHE.txt > nul

:: Copy CHANGES.txt
echo CHANGES.txt
copy %SRCDIR%\httpd-%APACHEVER%\CHANGES %INSTALLDIR%\CHANGES.txt > nul

:: Copy INSTALL.txt
echo INSTALL.txt
copy %SRCDIR%\httpd-%APACHEVER%\INSTALL %INSTALLDIR%\INSTALL.txt > nul

:: Copy README.txt
echo README.txt
copy %SRCDIR%\httpd-%APACHEVER%\README %INSTALLDIR%\README.txt > nul

:: Copy/Update NOTICE.txt
echo NOTICE.txt
copy %SRCDIR%\httpd-%APACHEVER%\NOTICE %INSTALLDIR%\NOTICE.txt > nul
echo. >> %INSTALLDIR%\NOTICE.txt
echo Regular expression support is provided by the PCRE library package, >> %INSTALLDIR%\NOTICE.txt
echo which is open source software, written by Philip Hazel, and copyright >> %INSTALLDIR%\NOTICE.txt
echo by the University of Cambridge, England. The original software is >> %INSTALLDIR%\NOTICE.txt
echo available from >> %INSTALLDIR%\NOTICE.txt
echo   ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ >> %INSTALLDIR%\NOTICE.txt
echo. >> %INSTALLDIR%\NOTICE.txt
echo This binary distribution includes cryptographic software written by >> %INSTALLDIR%\NOTICE.txt
echo Eric Young (eay@cryptsoft.com), software written by Tim Hudson >> %INSTALLDIR%\NOTICE.txt
echo (tjh@cryptsoft.com), and software developed by the OpenSSL Project >> %INSTALLDIR%\NOTICE.txt
echo for use in the OpenSSL Toolkit ^<http://www.openssl.org/^>. >> %INSTALLDIR%\NOTICE.txt

:: Copy/Update LICENCE.txt
echo LICENCE.txt
copy %SRCDIR%\httpd-%APACHEVER%\LICENSE %INSTALLDIR%\LICENSE.txt > nul
echo. >> %INSTALLDIR%\LICENSE.txt
echo For the pcre.dll component: >> %INSTALLDIR%\LICENSE.txt
echo. >> %INSTALLDIR%\LICENSE.txt
findstr /B /V End %SRCDIR%\pcre-%PCREVER%\LICENCE >> %INSTALLDIR%\LICENSE.txt
echo END OF PCRE LICENSE >> %INSTALLDIR%\LICENSE.txt
echo. >> %INSTALLDIR%\LICENSE.txt
echo For the libeay32.dll, ssleay32.dll and openssl.exe components: >> %INSTALLDIR%\LICENSE.txt
echo. >> %INSTALLDIR%\LICENSE.txt
type %SRCDIR%\openssl-%OPENSSLVER%\LICENSE >> %INSTALLDIR%\LICENSE.txt

:: Create OPENSSL-NEWS.txt
echo OPENSSL-NEWS.txt
echo. > %INSTALLDIR%\OPENSSL-NEWS.txt
echo  Apache HTTP Server 2.4 Limited OpenSSL Distribution >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo. >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  This binary distribution includes the minimal components of OpenSSL required >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  to support mod_ssl for Apache HTTP Server version 2.4 (details are listed >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  in OPENSSL-README.txt.)  For the complete list of CHANGES to this and later >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  versions of OpenSSL, please refer to the definative source, >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  ^<http://www.openssl.org/news/changelog.html^>, or see the CHANGES file in the >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  full binary or source distribution package from ^<http://www.openssl.org/^>. >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo. >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  These OpenSSL binaries were built for distribution from the U.S. without >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo  support for the patented encryption methods IDEA, MDC-2 or RC5. >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo. >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo -------------------------------------------------------------------------------- >> %INSTALLDIR%\OPENSSL-NEWS.txt
echo.>> %INSTALLDIR%\OPENSSL-NEWS.txt
copy %INSTALLDIR%\OPENSSL-NEWS.txt + %SRCDIR%\openssl-%OPENSSLVER%\NEWS %INSTALLDIR%\OPENSSL-NEWS.txt > nul

:: Create OPENSSL-README.txt
echo OPENSSL-README.txt
echo. > %INSTALLDIR%\OPENSSL-README.txt
echo  Apache HTTP Server 2.4 Limited OpenSSL Distribution >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
echo  This binary installation of OpenSSL is a limited distribution of the >> %INSTALLDIR%\OPENSSL-README.txt
echo  files derived from the OpenSSL project: >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
echo    LICENSE.txt (includes openssl LICENSE) >> %INSTALLDIR%\OPENSSL-README.txt
echo    OPENSSL-NEWS.txt >> %INSTALLDIR%\OPENSSL-README.txt
echo    OPENSSL-README.txt >> %INSTALLDIR%\OPENSSL-README.txt
echo    conf\openssl.cnf >> %INSTALLDIR%\OPENSSL-README.txt
echo    bin\libeay32.dll >> %INSTALLDIR%\OPENSSL-README.txt
echo    bin\ssleay32.dll >> %INSTALLDIR%\OPENSSL-README.txt
echo    bin\openssl.exe >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
echo  These are the minimal libraries and tools required to use mod_ssl as >> %INSTALLDIR%\OPENSSL-README.txt
echo  distributed with Apache HTTP Server version 2.4.  No library link files, >> %INSTALLDIR%\OPENSSL-README.txt
echo  headers or sources are distributed with this binary distribution.  Please >> %INSTALLDIR%\OPENSSL-README.txt
echo  refer to the ^<http://www.openssl.org/^> site for complete source or binary >> %INSTALLDIR%\OPENSSL-README.txt
echo  distributions. >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
echo  These OpenSSL binaries were built for distribution from the U.S. without >> %INSTALLDIR%\OPENSSL-README.txt
echo  support for the patented encryption methods IDEA, MDC-2 or RC5. >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
echo  The Apache HTTP Project only supports the binary distribution of these files >> %INSTALLDIR%\OPENSSL-README.txt
echo  and development of the mod_ssl module.  We cannot provide support assistance >> %INSTALLDIR%\OPENSSL-README.txt
echo  for using or configuring the OpenSSL package or these modules.  Please refer >> %INSTALLDIR%\OPENSSL-README.txt
echo  all installation and configuration questions to the appropriate forum, >> %INSTALLDIR%\OPENSSL-README.txt
echo  such as the user supported lists, ^<http://httpd.apache.org/userslist.html^> >> %INSTALLDIR%\OPENSSL-README.txt
echo  the Apache HTTP Server user's list or ^<http://www.openssl.org/support/^> the >> %INSTALLDIR%\OPENSSL-README.txt
echo  OpenSSL support page. >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
echo -------------------------------------------------------------------------------- >> %INSTALLDIR%\OPENSSL-README.txt
echo. >> %INSTALLDIR%\OPENSSL-README.txt
copy OPENSSL-README.txt + %SRCDIR%\openssl-%OPENSSLVER%\README %INSTALLDIR%\OPENSSL-README.txt > nul


I haven't put in any validation or error handling, but it's a start. Wink
Back to top
fwagner



Joined: 21 Aug 2008
Posts: 3

PostPosted: Tue 28 Apr '15 9:18    Post subject: Re: HOWTO: Building Apache 2.4.x for Windows x64 using CMake Reply with quote

Hello,

thank you for your howto. Based in your work I have created a powershell build script that automatically download the required tools and sources.

you can find the project on bitbucket:
http://bitbucket.org/wagnersolutions/apache-2.4-build-windows

Best Regards,
Frank Wagner
Back to top
skmyna



Joined: 03 Oct 2015
Posts: 1
Location: India

PostPosted: Sat 03 Oct '15 20:05    Post subject: Reply with quote

I found an answer of your question. You can follow this link to view it http://qnalist.com/questions/5377895/building-apr-using-cmake-on-windows.

I hope this will help you.
Back to top
satsharm



Joined: 27 Jun 2017
Posts: 3
Location: India,Bangalore

PostPosted: Tue 27 Jun '17 12:52    Post subject: Apache Compilation for Windows x64 Reply with quote

I have dependency on the below modules for building Apache 2.4.x windows x64 using the Visual Studio 2013 IDE:

pcre
lua
openssl
zlib
libxml2
nghttp2
httpd
apr
apr-util
apr-iconv

Please help me to compile the above modules and build the Apache.

Best Regards,
Satish
Back to top


Reply to topic   Topic: HOWTO: Building Apache 2.4.x for Windows x64 using CMake View previous topic :: View next topic
Post new topic   Forum Index -> How-to's & Documentation & Tips