Bug 40398

Summary: Cannot compile project on Windows SDK 6.0 (Vista), compiling errors in network _io\unix\multicast.c
Product: APR Reporter: sheldon robinson <sheldon.robinson>
Component: APRAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: RESOLVED FIXED    
Severity: normal CC: sander
Priority: P2    
Version: 1.2.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Attachments: enable IPv6+mcast groups
Dirtier of two solutions; enable IPv6 + mcast source groups
Cleaner of two solutions; enable IPv6 + mcast source groups

Description sheldon robinson 2006-09-02 16:51:55 UTC
I just need to know the #define where this is set


multicast.c
.\network_io\unix\multicast.c(137) : error C2079: 'mip' uses undefined struct
'group_source_req'
.\network_io\unix\multicast.c(168) : error C2224: left of '.gsr_interface' must
have struct/union type
.\network_io\unix\multicast.c(168) : warning C4013: 'find_if_index' undefined;
assuming extern returning int
.\network_io\unix\multicast.c(169) : error C2224: left of '.gsr_group' must have
struct/union type
.\network_io\unix\multicast.c(169) : error C2224: left of '.gsr_group' must have
struct/union type
.\network_io\unix\multicast.c(169) : error C2198: 'memcpy' : too few arguments
for call
.\network_io\unix\multicast.c(170) : error C2224: left of '.gsr_source' must
have struct/union type
.\network_io\unix\multicast.c(170) : error C2224: left of '.gsr_source' must
have struct/union type
.\network_io\unix\multicast.c(170) : error C2198: 'memcpy' : too few arguments
for call
Comment 1 William A. Rowe Jr. 2007-06-01 15:37:57 UTC
I'm not seeing this, so I'll presume it's fixed?

Reopen with much more detail if you still have issues.
Comment 2 Thai Ha 2007-06-08 10:35:45 UTC
I have the same problem with Windows SDK 6.0. I found a workaround solution at
http://procfs.blogspot.com/2007/02/build-apache-on-vista.html.
After more investigating on the issue I figured out that Windows SDK 6.0
introduces the new macro MCAST_JOIN_SOURCE_GROUP and that's the reason of the
error messages.

--- ws2ipdef.h --------
651: #define MCAST_JOIN_SOURCE_GROUP     45	// Join IP group/source.

748: #if (NTDDI_VERSION >= NTDDI_WINXP)
762: typedef struct group_source_req {
783: #endif

Clearly that in some cases, if the macro MCAST_JOIN_SOURCE_GROUP is defined,
struct group_source_req is not defined (because #if). On Linux
(http://lxr.oss.org.cn/source/include/linux/in.h), there is no #if
(NTDDI_VERSION >= NTDDI_WINXP) like that.

So I think if we change the code of multicast.c from

136: #if MCAST_JOIN_SOURCE_GROUP
148: #if MCAST_JOIN_SOURCE_GROUP

to

136: #if defined(group_source_req)
148: #if defined(group_source_req)

the error will be resolved.

I have updated the file multicast.c and it fixed the issue on my machine
(Windows XP, VS2005, Windows SDK 6.0) 
Comment 3 Thai Ha 2007-06-08 10:39:11 UTC
Created attachment 20330
Comment 4 William A. Rowe Jr. 2007-09-16 19:26:59 UTC
This test shouldn't work

#if defined(group_source_req)

because it's a struct not a #define.  We can do a HAVE_GROUP_SOURCE_REQ from
autoconf, and in the win32 case simply define it as '1' in our prepared flavor
of the .h.in headers we name .hw.


Comment 5 William A. Rowe Jr. 2007-10-15 23:55:02 UTC
I'll investigate this, but in the meantime DO NOT VIOLATE COPYRIGHTS 
by republishing copyrighted documents in violation of whatever license
or lack thereof you have.

The attachment has been purged, please don't make us do this again.
Comment 6 William A. Rowe Jr. 2007-12-26 12:51:56 UTC
Created attachment 21318 [details]
enable IPv6+mcast groups

Summary;

This moronic tangle of defintions and dependencies from the world according to 

the win32 api in SDK versions 6.0 and later; it unconditionally declares 
MCAST_JOIN_SOURCE_GROUP, while it declares group_source_req etc only for 
_WIN32_WINNT_WINXP and later.  Testing defined(GROUP_FILTER_SIZE) instead of 
MCAST_JOIN_SOURCE_GROUP within multicast.c would solve this connundrum.

The alternative of defining _WIN32_WINNT as _WIN32_WINNT_WINXP does solve, 
but need to confirm this doesn't have a side effect of breaking win2k etc.

A patch is attached
Comment 7 William A. Rowe Jr. 2007-12-26 13:58:11 UTC
Comment on attachment 21318 [details]
enable IPv6+mcast groups

Replacing...
Comment 8 William A. Rowe Jr. 2007-12-26 13:59:46 UTC
Created attachment 21319 [details]
Dirtier of two solutions; enable IPv6 + mcast source groups

Here's an updated patch (to trunk) with cleaner lineends which will compile
on pre-XP SDK's.
Comment 9 William A. Rowe Jr. 2007-12-26 14:01:27 UTC
Created attachment 21320 [details]
Cleaner of two solutions; enable IPv6 + mcast source groups

According to linux and win32 this may be a sufficiently portable alternative
to the dirty-patch.  Win32 defines this macro (unlike the MCAST_ macro group)
only for WinXP sdk level.
Comment 10 William A. Rowe Jr. 2008-01-02 19:44:21 UTC
Fixed for APR 1.2.13, the cleaner of the two patches was applied.