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 

miniupnpc.c:515,516,609 unknown reqn size, nor NI_MAXHOST

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation
View previous topic :: View next topic  
Author Message
Zartox



Joined: 27 Jun 2012
Posts: 6

PostPosted: Wed Jun 27, 2012 1:47 pm    Post subject: miniupnpc.c:515,516,609 unknown reqn size, nor NI_MAXHOST Reply with quote

I installed Linux [Mageia 2] on my box, and decided to try to compile a project using miniupnpc version 1.7 I think (it was updated a few days ago). Compilation was done with g++ and gcc 4.6.3 with most development libraries.

I got the following errors:
...
miniupnpc.c
../../dependencies/miniupnpc/miniupnpc.c: In function ‘upnpDiscover’:
../../dependencies/miniupnpc/miniupnpc.c:515:21: error: storage size of ‘reqn’ isn’t known
../../dependencies/miniupnpc/miniupnpc.c:516:29: error: invalid application of ‘sizeof’ to incomplete type ‘struct ip_mreqn’
../../dependencies/miniupnpc/miniupnpc.c:609:15: error: ‘NI_MAXHOST’ undeclared (first use in this function)
../../dependencies/miniupnpc/miniupnpc.c:609:15: note: each undeclared identifier is reported only once for each function it appears in
../../dependencies/miniupnpc/miniupnpc.c:609:33: error: ‘NI_MAXSERV’ undeclared (first use in this function)
make[1]: *** [obj/Debug/miniupnpc.o] Error 1
make: *** [gserver2] Error 2
[paul@localhost build]$
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1429

PostPosted: Fri Jun 29, 2012 8:24 am    Post subject: Reply with quote

please make sure the -D_BSD_SOURCE -D_POSIX_C_SOURCE=1 is passed to gcc
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Zartox



Joined: 27 Jun 2012
Posts: 6

PostPosted: Sat Jun 30, 2012 12:57 pm    Post subject: Reply with quote

It does compile and links fine with -D_BSD_SOURCE.
Although, the resulting executable, does SEGFAULT very early in vfprintf.
Edit 2: Found the reason, it was calling vfprintf two times, without a new va_start.

Not sure if it is related to building with -D_BSD_SOURCE on Linux or not however.
Should it be considered a workaround?
Edit2: Ok, I did read man feature_test_macros and now understand that it is quite normal to use #define _BSD_SOURCE in a Linux project.

Edit1: I removed the define in the Makefile and added at the beginning of miniupnpc.c:
#define _BSD_SOURCE
#define _POSIX_C_SOURCE 1
It still compile&links.

Edit2: Guess using those #define, rather than calling gcc with -D_BSD_SOURCE would be better.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation 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.