Error compiling cygwin 2.0.2-1: conflicting if_nametoindex declarations

James Johnston JamesJ@motionview3d.com
Thu May 21 23:05:00 GMT 2015


Hi,

I’m trying to compile 32-bit Cygwin 2.0.2 from source on a clean installation of Cygwin, but I’m running into a problem – it won’t compile due to this error:

c++wrap -O2 -g -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Wall -Wstrict-aliasing -Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0 -MMD -Werror -fmerge-constants -ftracer -c -o net.o ../../../../newlib-cygwin/winsup/cygwin/net.cc
../../../../newlib-cygwin/winsup/cygwin/net.cc: In function ‘unsigned int if_nametoindex(const char*)’:
../../../../newlib-cygwin/winsup/cygwin/net.cc:2448:33: error: conflicting declaration of C function ‘unsigned int if_nametoindex(const char*)’
 if_nametoindex (const char *name)
                                 ^
In file included from /usr/include/w32api/iphlpapi.h:170:0,
                 from ../../../../newlib-cygwin/winsup/cygwin/net.cc:34:
/usr/include/w32api/netioapi.h:374:29: note: previous declaration ‘NET_IFINDEX if_nametoindex(PCSTR)’
   NET_IFINDEX NETIOAPI_API_ if_nametoindex (PCSTR InterfaceName);
                             ^
../../../../newlib-cygwin/winsup/cygwin/net.cc: In function ‘char* if_indextoname(unsigned int, char*)’:
../../../../newlib-cygwin/winsup/cygwin/net.cc:2481:47: error: conflicting declaration of C function ‘char* if_indextoname(unsigned int, char*)’
 if_indextoname (unsigned ifindex, char *ifname)
                                               ^
In file included from /usr/include/w32api/iphlpapi.h:170:0,
                 from ../../../../newlib-cygwin/winsup/cygwin/net.cc:34:
/usr/include/w32api/netioapi.h:375:23: note: previous declaration ‘CHAR* if_indextoname(NET_IFINDEX, PCHAR)’
   PCHAR NETIOAPI_API_ if_indextoname (NET_IFINDEX InterfaceIndex, PCHAR InterfaceName);
                       ^
../../../../newlib-cygwin/winsup/cygwin/../Makefile.common:43: recipe for target 'net.o' failed


Examining the source for net.cc, I note the following comments at the top:

/* FIXME: Collision with different declarations of if_nametoindex and
	  if_indextoname functions in iphlpapi.h since Vista.
   TODO:  Convert if_nametoindex to cygwin_if_nametoindex and call
	  system functions on Vista and later. */

Huh?  Further examination shows that there is indeed a conflict.  But I examined the commit history in net.cc and it looks like nobody has changed anything related to this for years in that file.  The comment itself is quite old.  I'm a little amazed it's been working before.  What am I missing here to get Cygwin building?

One other minor quibble/note: I had to install texinfo package to get the build going; this isn't currently noted in the FAQ as a requirement.

Best regards,

James Johnston



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list