Bug 46416

Summary: Include order in jk_global.h breaks mod_jk build on Windows + Visual Studio 2005
Product: Tomcat Connectors Reporter: Tim Whittington <Tim.Whittington>
Component: mod_jkAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P1    
Version: 1.2.27   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Tim Whittington 2008-12-18 14:04:20 UTC
Building against the 1.2.27 tag, I've come across an issue with the order of includes in jk_global.h that breaks the build using Visual Studio 2005.

Some recent changes to keepalive code started using the tcp_keepalive struct in <mstcpip.h>, which is only included in jk_global.h if _WINDOWS_ is not already defined - i.e. if <windows.h> has not already been included.

Unfortunately <windows.h> is included by APR (at least in the Apache 2.0 build I have), and the APR headers are included before the #ifndef _WINDOWS_ block.
Switching the APR includes to below the #ifdef WIN32 block fixes the build.

It appears there's some fragility in the includes - it seems a bit odd that mod_jk is sensitive to being the first to import <windows.h> - but I didn't look hard enough at all the other defines/includes in there to say it could be separated out entirely.

(On a side note, <windows.h> is included in jk_mt.h, which may not be necessary).
Comment 1 Mladen Turk 2009-02-23 02:46:27 UTC
Can you check if the trunk jk_global.h fixes the build?
Comment 2 Tim Whittington 2009-02-23 12:43:29 UTC
Looks good now - thanks.