miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

HAS_IP_MREQN breaks compile on debian x64

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs
View previous topic :: View next topic  
Author Message
vexed



Joined: 27 Oct 2013
Posts: 2

PostPosted: Sun Oct 27, 2013 12:19 am    Post subject: HAS_IP_MREQN breaks compile on debian x64 Reply with quote

in miniupnpc.c:
Code:

#ifdef HAS_IP_MREQN
            /* was not an ip address, try with an interface name */
            struct ip_mreqn reqn;   /* only defined with -D_BSD_SOURCE or -D_GNU_SOURCE */
            memset(&reqn, 0, sizeof(struct ip_mreqn));
            reqn.imr_ifindex = if_nametoindex(multicastif);
            if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
            {
               PRINT_SOCKET_ERROR("setsockopt");
            }
#else

gcc (Debian 4.7.3-4) 4.7.3
results in:
Code:

miniupnpc.c: In function ‘upnpDiscover’:
miniupnpc.c:521:21: error: storage size of ‘reqn’ isn’t known
miniupnpc.c:522:29: error: invalid application of ‘sizeof’ to incomplete type ‘struct ip_mreqn’
miniupnpc.c:521:21: error: unused variable ‘reqn’ [-Werror=unused-variable]
cc1: all warnings being treated as errors
make[2]: *** [miniupnpc.o] Error 1


Forcing to compile without HAS_IP_MREQN has no errors, and it works as far as I can tell.
Code:

#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(MACOSX) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun)
// NOTE: This breaks our builds. (linux).  All other builds don't use this.
//#define HAS_IP_MREQN
#endif


Also note that in minissdpc.c, had to add
Code:
#if defined(_MSC_VER)
typedef SSIZE_T ssize_t;
#endif

to get it to compile on MSVC.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1469

PostPosted: Wed Nov 13, 2013 2:55 pm    Post subject: Reply with quote

As far as I know, struct mreqn is defined under linux when _BSD_SOURCE or _GNU_SOURCE macros are defined.
Code:
$ grep -R ip_mreqn /usr/include/
/usr/include/linux/in.h:struct ip_mreqn
/usr/include/bits/in.h:struct ip_mreqn

_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.