You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 27 Next »

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

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 of:

E.g.: To build the latest 1.2.x development build from trunk

 c:
 cd \
 svn co https://svn.apache.org/repos/asf/tomcat/native/trunk/ tomcat-native-1.2.x
 cd tomcat-native-1.2.x\native\srclib\apr

 

Unpack APR 1.6.5 source distribution in this directory (C:\tomcat-native-1.2.x\native\srclib\apr).    

Apply the apr-enable-ipv6.patch. Note that the patch will apply but depending on exactly which revision you are working with you may need to skip the first part of the patch and an offset will probably be required.    

 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    cd ..\openssl

OpenSSL 1.1.0 and earlier

Unpack the OpenSSL 1.0.2q source distribution in this directory (C:\tomcat-native-1.2.x\native\srclib\openssl).

Apply openssl-msvcrt.patch. Note that the patch will apply but depending on exactly which revision you are working with you may need to skip the first part of the patch.

 c:\cmsc\setenv.bat /x86
 perl Configure VC-WIN32
 ms\do_nasm
 nmake -f ms\nt.mak
 move out32 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

OpenSSL 1.1.1 and later

Unpack the OpenSSL 1.1.1a source distribution in this directory (C:\tomcat-native-1.2.x\native\srclib\openssl).

Apply openssl-msvcrt-1.1.1.patch. Note that 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
 nmake
mkdir out32-x86
copy libssl.lib out32-x86\
copy libcrypto.lib out32-x86\
copy apps\openssl.exe out32-x86\

nmake clean

c:\cmsc\setenv.bat /x64
perl Configure 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=1.0.2q
set APR_VER=1.6.5
 
 mkdir \deps-x86\apr-%APR_VER%\include
 mkdir \deps-x86\apr-%APR_VER%\lib
 mkdir \deps-x86\openssl-%OPENSSL_VER%\include
 mkdir \deps-x86\openssl-%OPENSSL_VER%\lib
 xcopy /E \deps-x86\apr-%APR_VER% \deps-x64\apr-%APR_VER%\
xcopy /E \deps-x86\openssl-%OPENSSL_VER% \deps-x64\openssl-%OPENSSL_VER%\
 
 xcopy /E apr\include \deps-x86\apr-%APR_VER%\include\
 xcopy /E apr\include \deps-x64\apr-%APR_VER%\include\
 
 copy apr\WINXP_X86_LIB_RELEASE\apr-1.lib \deps-x86\apr-%APR_VER%\lib
 copy apr\WINXP_X64_LIB_RELEASE\apr-1.lib \deps-x64\apr-%APR_VER%\lib
OpenSSL 1.1.0 and earlier
 xcopy /E openssl\inc32 \deps-x86\openssl-%OPENSSL_VER%\include\
 xcopy /E openssl\inc32 \deps-x64\openssl-%OPENSSL_VER%\include\
OpenSSL 1.1.1 and later
 xcopy /E openssl\include\openssl \deps-x86\openssl-%OPENSSL_VER%\include\openssl\
 xcopy /E openssl\include\openssl \deps-x64\openssl-%OPENSSL_VER%\include\openssl\
All OpenSSL versions

 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 ..
 SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71
OpenSSL 1.1.0 and earlier
 c:\cmsc\setenv.bat /x86
 nmake -f NMAKEMakefile WITH_APR=C:\deps-x86\apr-%APR_VER% WITH_OPENSSL=C:\deps-x86\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1 ENABLE_OCSP=1
 move WINXP_X86_DLL_RELEASE WINXP_X86_OCSP_DLL_RELEASE
 nmake -f NMAKEMakefile WITH_APR=C:\deps-x86\apr-%APR_VER% WITH_OPENSSL=C:\deps-x86\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1
 
 c:\cmsc\setenv.bat /x64
 nmake -f NMAKEMakefile WITH_APR=C:\deps-x64\apr-%APR_VER% WITH_OPENSSL=C:\deps-x64\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1 ENABLE_OCSP=1
 move WINXP_X64_DLL_RELEASE WINXP_X64_OCSP_DLL_RELEASE
 nmake -f NMAKEMakefile WITH_APR=C:\deps-x64\apr-%APR_VER% WITH_OPENSSL=C:\deps-x64\openssl-%OPENSSL_VER% APR_DECLARE_STATIC=1
OpenSSL 1.1.1 and later

As above but add:

 OPENSSL_NEW_LIBS=1

to each of the nmake lines

 

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

Construct the binary distributions    

 set OPENSSL_VER=1.1.1a
set VER=1.2.18
 mkdir tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin
 copy LICENSE.bin.win tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\LICENSE
copy NOTICE.bin.win 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%-openssl-%OPENSSL_VER%-win32-bin\bin\x64
 copy C:\deps-x86\openssl-%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 WINXP_X86_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin
 copy WINXP_X86_OCSP_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin
 copy WINXP_X86_DLL_RELEASE\tcnative-1-src.pdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin
 copy WINXP_X86_OCSP_DLL_RELEASE\tcnative-1-src.pdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin
 copy WINXP_X64_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin\x64
 copy WINXP_X64_OCSP_DLL_RELEASE\tcnative-1.dll tomcat-native-%VER%-openssl-%OPENSSL_VER%-ocsp-win32-bin\bin\x64
 copy WINXP_X64_DLL_RELEASE\tcnative-1-src.pdb tomcat-native-%VER%-openssl-%OPENSSL_VER%-win32-bin\bin\x64
 copy WINXP_X64_OCSP_DLL_RELEASE\tcnative-1-src.pdb 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-1.2.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-1.1.32-ocsp-win32-bin.zip.md5    

  0b0e1e4c77b9b7051fc2c751b70d2880 *tomcat-native-1.1.32-ocsp-win32-bin.zip

tomcat-native-1.1.32-ocsp-win32-bin.zip.sha1    

  b47f96dd3153d002a529e881b6b8f524cd6e321c *tomcat-native-1.1.32-ocsp-win32-bin.zip
  • No labels