Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update pdb file names

 This page describes the process for building the Windows Native Connector for Windows. This is the native part of the APR/Native connector.   

The instructions on this page reference specific versions of numerous tools and dependencies. The versions referenced on this page are known to work. Other versions may work. Where information is available on the suitability (or otherwise) of alternative versions it is provided. All installations use default settings unless explicitly noted otherwise. Non-default settings in italics are provided for completeness but are believed not to impact on the success of the build process. Non-default settings in standard type may, or may not, impact the success of the build process.   

Hardware

 Known working configurations include:  

  1. VMware virtual machine  
    • 60GB HDD  

    • 2 processors  

    • 2GB RAM  

    • No USB  

    • No sound  

    • Bridged networking  

  2. Others TBD   

Operating System

Known working configurations include:  

  1. Windows 7  
    • Static IP address  

    • 1600x1200 screen resolution  

    • UTC timezone  

    • Install VMware Tools  
    • Apply all updates  

  2. Others TBD   

Build tools

  1. Mladen's Custom Microsoft Compiler Toolkit Compilation  
    • Git for windows (http://git-scm.com/) 1.9.4-20140611  

    • https://github.com/mturk/cmsc (cb6be932c8c95a46262a64a89e68aae620dfdcee)  

      • Windows SDK  
        • No documentation  
        • No samples  
        • Complete set of developer tools  
      • Windows DDK  
        • Build environments  
        • Tools  
      • Compile as per <cmsc-root>/tools/README.txt  

      • Install Perl as per <cmsc-root>/tools/README.txt  

    • TortoiseSVN (http://tortoisesvn.net/) 1.8.7 64-bit  

    • 7-Zip 9.20 64-bit  
    • JDK 1.7.0_71 64-bit  
  2. Others TBD   

These instructions assume that you have configured the common build environment.

Building

While tcnative itself needs to be built last, we unpack it first because there are some patches in the tcnative source distribution that will need to be applied to both APR and OpenSSL. Obtain the tcnative source from one offof:

E.g.: To build the latest 12.20.x development build from trunkmain

  c:
 cd \
 svn git coclone https://svngithub.com/apache.org/repos/asf/tomcat/-native/trunk/ tomcat-native-12.20.x
 cd tomcat-native-12.20.x\native\srclib\apr

 


Unpack APR 1.5.1 (I haven't been able to get this to work with APR 1.5.2) 7.4 source distribution in this directory (C:\tomcat-native-12.20.x\native\srclib\apr).    

Apply the apr-enable-ipv6.patch. Note that the patch will Note: If you build the 1.2.x branch you will need to some patches. The patches should apply but depending on exactly which revision you are working with an offset may be required of ~6 lines.             you may need to skip parts of the patch and/or apply an offset.

git apply apr-enable-ipv6.patch
git apply win-ipv6.patch

Then build:

  c:\cmsc\setenv.bat /x86 
nmake -f NMAKEmakefile BUILD_CPU=x86 APR_DECLARE_STATIC=1    c:\cmsc\setenv.bat /x64  nmake -f NMAKEmakefile BUILD_CPU=x64 APR_DECLARE_STATIC=1    c:\cmsc\setenv.bat /i64  nmake -f NMAKEmakefile BUILD_CPU=i64 APR_DECLARE_STATIC=1    cd ..\openssl

OpenSSL 3.0.x and later

Unpack the OpenSSL

...

3.0.

...

x source distribution in this directory (C:\tomcat-native-

...

2.

...

0.x\native\srclib\openssl).

...

Apply openssl-msvcrt

...

-3.0.x.patch. The patch should apply cleanly to the current recommended OpenSSL version. If you use a different version you may need to skip and/or use an offset to get the patch to apply.

  c:\cmsc\setenv.bat /x86
 
perl Configure no-shared VC-WIN32  ms\do_nasm  nmake -f ms\nt.mak  move out32
 nmake
mkdir out32-x86
copy libssl.lib out32-x86    c:\cmsc\setenv.bat /x64  perl Configure VC-WIN64A  ms\do_win64a  nmake -f ms\nt.mak clean  nmake -f ms\nt.mak  move out32 out32-x64    \
copy libcrypto.lib out32-x86\
copy apps\openssl.exe out32-x86\

nmake clean

c:\cmsc\setenv.bat /i64  x64
perl Configure VC-WIN64I  ms\do_win64i  nmake -f ms\nt.mak clean  nmake -f ms\nt.mak  move out32 out32-i64

...

no-shared VC-WIN64A
 nmake
mkdir out32-x64
copy libssl.lib out32-x64\
copy libcrypto.lib out32-x64\
copy apps\openssl.exe out32-x64\

Tomcat Native

Keeping the various libraries in versioned directories saves having to rebuild them next time if the version remains unchanged.                                              

  cd ..
 set OPENSSL_VER=3.0.11
set APR_VER=1.7.4
 
 mkdir \deps-x86\apr-1.5.1%APR_VER%\include
 mkdir \deps-x86\apr-1.5.1%APR_VER%\lib
 mkdir \deps-x86\openssl-1.0.2d%OPENSSL_VER%\include
 mkdir \deps-x86\openssl-1.0.2d%OPENSSL_VER%\lib
 xcopy /E \deps-x86\apr-%APR_VER% \deps-x64\
 apr-%APR_VER%\
xcopy /E \deps-x86 \deps-i64\    xcopy /E apr\include openssl-%OPENSSL_VER% \deps-x86x64\apr-1.5.1\include\openssl-%OPENSSL_VER%\
 
 xcopy /E apr\include \deps-x64x86\apr-1.5.1%APR_VER%\include\
 xcopy /E apr\include \deps-i64x64\apr-1.5.1%APR_VER%\include\
 
 copy apr\WINXPWIN7_X86_LIB_RELEASE\apr-1.lib \deps-x86\apr-1.5.1%APR_VER%\lib
 copy apr\WINXPWIN7_X64_LIB_RELEASE\apr-1.lib \deps-x64\apr-1.5.1\lib
 copy apr\WINXP_I64_LIB_RELEASE\apr-1.lib \deps-i64\apr-1.5.1\lib
 
 xcopy%APR_VER%\lib
 xcopy /E openssl\inc32include\openssl \deps-x86\openssl-1.0.2d%OPENSSL_VER%\include\openssl\
 xcopy xcopy /E openssl\inc32include\openssl \deps-x64\openssl-1.0.2d%OPENSSL_VER%\include\
 xcopy /E openssl\inc32 \deps-i64\openssl-1.0.2d\include\
 
 copy openssl

 copy openssl\out32-x86\*.lib

...

\deps-x86\openssl-

...

%OPENSSL_VER%\lib\

...


 copy openssl\out32-x64\*.lib

...

\deps-x64\openssl-

...

%OPENSSL_VER%\lib\

...

 copy openssl\out32-

...

x86\

...

openssl.

...

exe \deps-x86\openssl-%OPENSSL_VER%\
 copy openssl\out32-x64\openssl.exe \deps-x64\openssl-%OPENSSL_VER%\

 
 cd ..
seti64\openssl-1.0.2d\lib\    cd ..  SET JAVA_HOME=C:\java\adopt-8.0.242.09-x64
 Program Files\Java\jdk1.7.0_71
 
 c:\cmsc\setenv.bat /x86
 nmakex86
set WINVER=WIN7
 nmake -f NMAKEMakefile WITH_APR=C:\deps-x86\apr-1.5.1%APR_VER% WITH_OPENSSL=C:\deps-x86\openssl-1.0.2d%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1 ENABLE_OCSP=1  move WINXP
 move WIN7_X86_DLL_RELEASE WINXPWIN7_X86_OCSP_DLL_RELEASE  nmake
 nmake -f NMAKEMakefile WITH_APR=C:\deps-x86\apr-1.5.1%APR_VER% WITH_OPENSSL=C:\deps-x86\openssl-1.0.2d%OPENSSL_VER% APR_DECLARE_STATIC=1    c OPENSSL_NEW_LIBS=1
 
 c:\cmsc\setenv.bat /x64
 nmake
set WINVER=WIN7  nmake -f NMAKEMakefile WITH_APR=C:\deps-x64\apr-1.5.1%APR_VER% WITH_OPENSSL=C:\deps-x64\openssl-1.0.2d%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1 ENABLE_OCSP=1  move move WINXPWIN7_X64_DLL_RELEASE WINXPWIN7_X64_OCSP_DLL_RELEASE  nmake nmake -f NMAKEMakefile WITH_APR=C:\deps-x64\apr-1.5.1%APR_VER% WITH_OPENSSL=C:\deps-x64\openssl-1.0.2d APR_DECLARE_STATIC=1    c:\cmsc\setenv.bat /i64  nmake -f NMAKEMakefile WITH_APR=C:\deps-i64\apr-1.5.1 WITH_OPENSSL=C:\deps-i64\openssl-1.0.2d APR_DECLARE_STATIC=1 ENABLE_OCSP=1  move WINXP_I64_DLL_RELEASE WINXP_I64_OCSP_DLL_RELEASE  nmake -f NMAKEMakefile WITH_APR=C:\deps-i64\apr-1.5.1 WITH_OPENSSL=C:\deps-i64\openssl-1.0.2d APR_DECLARE_STATIC%OPENSSL_VER% APR_DECLARE_STATIC=1 OPENSSL_NEW_LIBS=1

 

Tomcat Native Connector DLLs may then be found in C:\tomcat-native-12.20.x\native\WINXPWIN7_*_[OCSP_]DLL_RELEASE    

Construct the binary distributions                              

  set VER=1.2.0
 mkdir.6
 mkdir tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin
 copy
 copy LICENSE.bin.\LICENSEwin tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\  LICENSE
copy NOTICE.bin.\NOTICEwin tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\  NOTICE
copy ..\README.txt tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\  
copy srclib\VERSIONS tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\

 mkdir tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin
 mkdir tomcat-native-%VER%-win32-bin\bin\i64
 mkdir tomcat-native-%VER%openssl-%OPENSSL_VER%-win32-bin\bin\x64
 copy srclibC:\deps-x86\openssl\out32-x86%OPENSSL_VER%\openssl.exe tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin
 xcopy /E tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\
 copy WINXPWIN7_X86_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin
 copy WINXPWIN7_X86_OCSP_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin
 copy WINXPWIN7_X86_DLL_RELEASE\tcnative-1-src.pdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin
 copy WINXPWIN7_X86_OCSP_DLL_RELEASE\tcnative-1-src.pdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin
 copy WINXPWIN7_I64X64_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin\i64x64
 copy WINXPWIN7_I64X64_OCSP_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin\i64x64
 copy WINXPWIN7_X64_DLL_RELEASE\tcnative-1.dllpdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin\x64
 copy WINXPWIN7_X64_OCSP_DLL_RELEASE\tcnative-1.dllpdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin\x64
 
 set PATH=%PATH%;%JAVA_HOME%\bin
 cd tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin
 jar -cMf ..\tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin.zip *
 cd ..\tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin
 jar -cMf ..\tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin.zip *

  

The Windows binary distributions may then be found in C:\tomcat-native-12.20.x\native\    

These need to be signed and hashed before uploading for the release vote.    

Beware of typos in the name and contents of hash files for OCSP binaries ("ocsp" vs "oscp"). Such typos happened.    

A correct example:    

tomcat-native-

...

2.0.5-openssl-3.0.10-ocsp-win32-bin.zip.

...

sha512

8b82033602be8f47905804349093045b99ba9cc3f2dbf95d52be2a430bae84bbefd0b938f6b0fa9d5c54af20fcb4a00b4dd2325d7482d3cf59a2463c0935d86f 0b0e1e4c77b9b7051fc2c751b70d2880 *tomcat-native-1.1.322.0.5-openssl-3.0.10-ocsp-win32-bin.zip

...

tomcat-native-

...

2.

...

0.

...

5-openssl-3.0.10-win32-bin.zip.

...

sha512

3c599d4da5c26b3dd1ddce7add5b8126e98f0068515f8bb942cc349716ea5f88519b9a1f76b3ba9badda79955f88eaf7940a78713064ccc547a232b921c0f05b b47f96dd3153d002a529e881b6b8f524cd6e321c *tomcat-native-12.10.32-ocsp5-openssl-3.0.10-win32-bin.zip