Error Redefinition Of Struct In6_addr
org> Cc: libc-alpha sourceware org, netdev vger kernel org, linux-kernel vger kernel org, David, carlos systemhalted org, schwab suse de, tgraf suug ch, libvirt-list redhat com, Miller Subject: [libvirt] Redefinition of struct in6_addr in and Date: Wed, 16 Jan 2013 14:06:06 +0800 (Cc'ing some glibc developers...) Hello, In glibc source file inet/netinet/in.h and kernel source file include/uapi/linux/in6.h, both define struct in6_addr, and both are visible to user applications. Thomas reported a conflict below. So, how can we handle this? /me is wondering why we didn't see this before. Thanks. On Tue, 2013-01-15 at 12:55 +0200, Thomas Backlund wrote: > Cong Wang skrev 15.1.2013 12:11: > > > > Does the following patch help? > > > > $ git diff include/uapi/linux/if_bridge.h > > diff --git a/include/uapi/linux/if_bridge.h > > b/include/uapi/linux/if_bridge.h > > index 5db2975..653db23 100644 > > --- a/include/uapi/linux/if_bridge.h > > +++ b/include/uapi/linux/if_bridge.h > > @@ -14,6 +14,7 @@ > > #define _UAPI_LINUX_IF_BRIDGE_H > > > > #include > > +#include > > > > #define SYSFS_BRIDGE_ATTR "bridge" > > #define SYSFS_BRIDGE_FDB "brforward" > > > > Well, I suggested the same fix in the beginning of the thread > on netdev and lkml: "if_bridge.h: include in6.h for struct in6_addr use" > > as it seemed to fix the libvirt case > > but then asked it to be ignored after I tried to build connman, > and hit this conflict with glibc-2.17: > > In file included from /usr/include/arpa/inet.h:22:0, > from ./include/connman/inet.h:25, > from src/connman.h:128, > from src/tethering.c:40: > /usr/include/netinet/in.h:35:5: error: expected identifier before > numeric constant > /usr/include/netinet/in.h:197:8: error: redefinition of 'struct in6_addr' > In file included from /usr/include/linux/if_bridge.h:17:0, > from src/tethering.c:38: > /usr/include/linux/in6.h:30:8: note: originally defined here > In file included from /usr/include/arpa/inet.h:22:0, > from ./include/connman/inet.h:25, > from src/connman.h:128, > from src/tethering.c:40: > /usr/include/netinet/in.h:238:8: error: redefinition of 'struct > sockaddr_in6' > In file included from /usr/include/linux/if_bridge.h:17:0, > from src/tethering.c:38: > /usr/include/linux/in6.h:46:8: note: originally defined here > In file included from /usr/include/arpa/inet.h:22:0, > from ./include/connman/inet.h:25, > from src/connman.h:128, > from src/tethering.c:40: > /usr/include/netinet/in.h:274:8: error: redefinition of 'struct ipv6_mreq'
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it https://www.redhat.com/archives/libvir-list/2013-January/msg01084.html only takes a minute: Sign up Can not include “linux/in6.h” without errors on Ubuntu 12.10 up vote 3 down vote favorite I can not include the linux/in6.h header into my source code without getting these redefinition errors: In file included from mypmtud.cc:30:0: /usr/include/linux/in6.h:30:8: error: redefinition of ‘struct in6_addr’ In file included from /usr/include/netdb.h:28:0, from mypmtud.cc:23: /usr/include/netinet/in.h:198:8: error: previous definition of ‘struct http://stackoverflow.com/questions/14202261/can-not-include-linux-in6-h-without-errors-on-ubuntu-12-10 in6_addr’ In file included from mypmtud.cc:30:0: /usr/include/linux/in6.h:46:8: error: redefinition of ‘struct sockaddr_in6’ In file included from /usr/include/netdb.h:28:0, from mypmtud.cc:23: /usr/include/netinet/in.h:239:8: error: previous definition of ‘struct sockaddr_in6’ In file included from mypmtud.cc:30:0: /usr/include/linux/in6.h:54:8: error: redefinition of ‘struct ipv6_mreq’ In file included from /usr/include/netdb.h:28:0, from mypmtud.cc:23: /usr/include/netinet/in.h:275:8: error: previous definition of ‘struct ipv6_mreq’ make: *** [mypmtud] Error 1 How can I include the linux/in6.h file into my code? I need linux/in6.h for IPV6_DONTFRAG definition and setsockopt() to understand this option. All other header files i have included: #include #include #include #include #include #include #include #include #include #include #include
`struct in6_addr'? From: "Larry Hall (Cygwin)" To: cygwin at cygwin dot com Date: Wed, 24 Apr 2013 14:37:38 -0400 Subject: https://cygwin.com/ml/cygwin/2013-04/msg00392.html Re: Redefinition of `struct in6_addr'? References: https://cygwin.com/ml/cygwin/2013-04/msg00382.html dot com> <20130424154409 dot GX26397 at calimero dot vinschen dot de> <20130424175107 dot GZ26397 at calimero dot vinschen dot de> <20130424175359 error redefinition dot GH5968 at type dot youpi dot perso dot aquilenet dot fr> <20130424181248 dot GA26397 at calimero dot vinschen dot de> Reply-to: cygwin at cygwin dot com On 4/24/2013 2:12 PM, Corinna Vinschen wrote: On Apr 24 19:53, Samuel Thibault wrote: Corinna Vinschen, le Wed 24 Apr 2013 19:51:07 +0200, a Ãcrit : /usr/include/cygwin/in6.h:75:8: error: redefinition error redefinition of of âstruct in6_addrâ /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/in6addr.h:17:16: note: originally defined here Don't know this file but this is a bug in config.h. struct in6_addr is defined in a system header, so it should not be gratuitously defined in a project header, especially if the definition collides with the right one from the system header. Mmm, but here it's w32api definition vs cygwin definition. Maybe I didn't read it exactly, but the bottom line here is, when building for Cygwin, either use the POSIX network headers (preferredly), or use winsock.h. Mixing them is not supported. Yeah, though this case is a bit buried, so it's not obvious. Also the code is from 2008, so I expect it has suffered some bit rot over time with respect to Cygwin. In any case, it looks like removing iphlpapi.h from sysdep.c solves the problem. -- Larry _____________________________________________________________________ A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoyi
`struct in6_addr'? From: Max Balduino To: cygwin at cygwin dot com Date: Wed, 24 Apr 2013 19:26:42 +0200 Subject: Re: Redefinition of `struct in6_addr'? References: <20130424154409 dot GX26397 at calimero dot vinschen dot de> On Wed, Apr 24, 2013 at 6:15 PM, Max Balduino >> On Apr 24 17:34, Max Balduino wrote: >>> Dear all, >>> >>> Looks like there's something wrong here: >>> >>> userwinemt@ioxp /usr/src/vpnc-0.5.2 >>> $ make install >>> LC_ALL=C perl -w ./enum2debug.pl isakmp.h >vpnc-debug.c 2>vpnc-debug.h >>> gcc -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings >>> -DVERSION=\"0.5.2\" -c -o sysdep.o sysdep.c >>> In file included from /usr/include/cygwin/in.h:267, >>> from /usr/include/netinet/in.h:14, >>> from sysdep.h:23, >>> from sysdep.c:71: >>> /usr/include/cygwin/in6.h:76: error: redefinition of `struct in6_addr' >>> >>> I'm compiling vpnc-0.5.2 on a fresh cygwin environment, just >>> downloaded from stable distribution. I'm using gcc version 3.4.4 >>> (cygming special, gdc 0.12, using dmd 0.125). I've googled for it and >>> found a post reading "Problems with latest cygwin + latest sources" >>> that claims for the same error. >>> >>> Anybody has seen this before or has a quick workaround, please? >> >> - You are not using the right mailing list for this kind of question. >> Use the cygwin AT cygwin DOT com list instead. >> >> - You're using an old and outdated compiler. Install the gcc4 package >> instead. >> >> - You're missing to paste the entire error message. Gcc usually prints >> where the clashing definition is defined, too. But maybe that's just >> in gcc 4.x. >> >> - Last but not least, a simple testcase would be helpful. >> >> Without that I can only guess: The file includes winsock.h because >> it wrongly treats Cygwin as Windows environment. Don't do that. >> >> >> Corinna >> >> -- >> Corinna Vinschen Please, send mails regarding Cygwin to >> Cygwin Maintainer cygwin AT cygwin DOT com >> Red Hat > > First of all thanks a *LOT* for your quick answer! > > OK, sorry for having used the wrong mail-list! I re-compiled under gcc > version 4.5.3 (GCC) getting same result. >