Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 577464

Summary: sys-apps/iproute2-4.5.0[-iptables]: error: redeclaration of enumerator ‘IFF_*’
Product: Gentoo Linux Reporter: Perfect Gentleman <perfect007gentleman>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: ao, awilfox.gentoo, bertrand, bkohler, bug, carlphilippreh, che, cj.wijtmans, cryptopsy, gentoo, h.mth, karl.j.linden, marduk, pesa, proteuss, reuben-gentoo-bugzilla, skrattaren, vityokster, wtt6, xaviermiller, zszafran
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://thread.gmane.org/gmane.linux.network/393907/focus=394053
See Also: https://bugs.gentoo.org/show_bug.cgi?id=577660
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: iproute2-4.5.0-no-iptables.patch

Description Perfect Gentleman 2016-03-15 11:50:16 UTC
x86_64-pc-linux-gnu-gcc -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -march=native -mtune=native -O2 -pipe -fomit-frame-pointer -fno-stack-protector  -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/lib64\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -march=native -mtune=native -O2 -pipe -fomit-frame-pointer -fno-stack-protector -DHAVE_SETNS -DCONFIG_GACT -DCONFIG_GACT_PROB -DYY_NO_INPUT   -c -o m_ipt.o m_ipt.c
x86_64-pc-linux-gnu-ar rcs libtc.a tc_core.o tc_red.o tc_cbq.o tc_estimator.o tc_stab.o
In file included from m_ipt.c:17:0:
../include/linux/if.h:92:19: error: redeclaration of enumerator ‘IFF_UP’
 #define IFF_UP    IFF_UP
                   ^
../include/linux/if.h:71:2: note: previous definition of ‘IFF_UP’ was here
  IFF_UP    = 1<<0,  /* sysfs */
  ^
../include/linux/if.h:93:25: error: redeclaration of enumerator ‘IFF_BROADCAST’
 #define IFF_BROADCAST   IFF_BROADCAST
                         ^
../include/linux/if.h:72:2: note: previous definition of ‘IFF_BROADCAST’ was here
  IFF_BROADCAST   = 1<<1,  /* __volatile__ */
  ^
../include/linux/if.h:94:21: error: redeclaration of enumerator ‘IFF_DEBUG’
 #define IFF_DEBUG   IFF_DEBUG
                     ^
../include/linux/if.h:73:2: note: previous definition of ‘IFF_DEBUG’ was here
  IFF_DEBUG   = 1<<2,  /* sysfs */
  ^
../include/linux/if.h:95:24: error: redeclaration of enumerator ‘IFF_LOOPBACK’
 #define IFF_LOOPBACK   IFF_LOOPBACK
                        ^
../include/linux/if.h:74:2: note: previous definition of ‘IFF_LOOPBACK’ was here
  IFF_LOOPBACK   = 1<<3,  /* __volatile__ */
  ^
../include/linux/if.h:96:27: error: redeclaration of enumerator ‘IFF_POINTOPOINT’
 #define IFF_POINTOPOINT   IFF_POINTOPOINT
                           ^
../include/linux/if.h:75:2: note: previous definition of ‘IFF_POINTOPOINT’ was here
  IFF_POINTOPOINT   = 1<<4,  /* __volatile__ */
  ^
../include/linux/if.h:97:26: error: redeclaration of enumerator ‘IFF_NOTRAILERS’
 #define IFF_NOTRAILERS   IFF_NOTRAILERS
                          ^
../include/linux/if.h:76:2: note: previous definition of ‘IFF_NOTRAILERS’ was here
  IFF_NOTRAILERS   = 1<<5,  /* sysfs */
  ^
../include/linux/if.h:98:23: error: redeclaration of enumerator ‘IFF_RUNNING’
 #define IFF_RUNNING   IFF_RUNNING
                       ^
../include/linux/if.h:77:2: note: previous definition of ‘IFF_RUNNING’ was here
  IFF_RUNNING   = 1<<6,  /* __volatile__ */
  ^
../include/linux/if.h:99:21: error: redeclaration of enumerator ‘IFF_NOARP’
 #define IFF_NOARP   IFF_NOARP
                     ^
../include/linux/if.h:78:2: note: previous definition of ‘IFF_NOARP’ was here
  IFF_NOARP   = 1<<7,  /* sysfs */
  ^
../include/linux/if.h:100:23: error: redeclaration of enumerator ‘IFF_PROMISC’
 #define IFF_PROMISC   IFF_PROMISC
                       ^
../include/linux/if.h:79:2: note: previous definition of ‘IFF_PROMISC’ was here
  IFF_PROMISC   = 1<<8,  /* sysfs */
  ^
../include/linux/if.h:101:24: error: redeclaration of enumerator ‘IFF_ALLMULTI’
 #define IFF_ALLMULTI   IFF_ALLMULTI
                        ^
../include/linux/if.h:80:2: note: previous definition of ‘IFF_ALLMULTI’ was here
  IFF_ALLMULTI   = 1<<9,  /* sysfs */
  ^
../include/linux/if.h:102:22: error: redeclaration of enumerator ‘IFF_MASTER’
 #define IFF_MASTER   IFF_MASTER
                      ^
../include/linux/if.h:81:2: note: previous definition of ‘IFF_MASTER’ was here
  IFF_MASTER   = 1<<10, /* __volatile__ */
  ^
../include/linux/if.h:103:21: error: redeclaration of enumerator ‘IFF_SLAVE’
 #define IFF_SLAVE   IFF_SLAVE
                     ^
../include/linux/if.h:82:2: note: previous definition of ‘IFF_SLAVE’ was here
  IFF_SLAVE   = 1<<11, /* __volatile__ */
  ^
../include/linux/if.h:104:25: error: redeclaration of enumerator ‘IFF_MULTICAST’
 #define IFF_MULTICAST   IFF_MULTICAST
                         ^
../include/linux/if.h:83:2: note: previous definition of ‘IFF_MULTICAST’ was here
  IFF_MULTICAST   = 1<<12, /* sysfs */
  ^
../include/linux/if.h:105:23: error: redeclaration of enumerator ‘IFF_PORTSEL’
 #define IFF_PORTSEL   IFF_PORTSEL
                       ^
../include/linux/if.h:84:2: note: previous definition of ‘IFF_PORTSEL’ was here
  IFF_PORTSEL   = 1<<13, /* sysfs */
  ^
../include/linux/if.h:106:25: error: redeclaration of enumerator ‘IFF_AUTOMEDIA’
 #define IFF_AUTOMEDIA   IFF_AUTOMEDIA
                         ^
../include/linux/if.h:85:2: note: previous definition of ‘IFF_AUTOMEDIA’ was here
  IFF_AUTOMEDIA   = 1<<14, /* sysfs */
  ^
../include/linux/if.h:107:23: error: redeclaration of enumerator ‘IFF_DYNAMIC’
 #define IFF_DYNAMIC   IFF_DYNAMIC
                       ^
../include/linux/if.h:86:2: note: previous definition of ‘IFF_DYNAMIC’ was here
  IFF_DYNAMIC   = 1<<15, /* sysfs */
  ^
In file included from ../include/xtables.h:16:0,
                 from ../include/iptables.h:5,
                 from m_ipt.c:18:
/usr/include/net/if.h:111:8: error: redefinition of ‘struct ifmap’
 struct ifmap
        ^
In file included from m_ipt.c:17:0:
../include/linux/if.h:169:8: note: originally defined here
 struct ifmap {
        ^
In file included from ../include/xtables.h:16:0,
                 from ../include/iptables.h:5,
                 from m_ipt.c:18:
/usr/include/net/if.h:126:8: error: redefinition of ‘struct ifreq’
 struct ifreq
        ^
In file included from m_ipt.c:17:0:
../include/linux/if.h:203:8: note: originally defined here
 struct ifreq {
        ^
In file included from ../include/xtables.h:16:0,
                 from ../include/iptables.h:5,
                 from m_ipt.c:18:
/usr/include/net/if.h:176:8: error: redefinition of ‘struct ifconf’
 struct ifconf
        ^
In file included from m_ipt.c:17:0:
../include/linux/if.h:252:8: note: originally defined here
 struct ifconf  {
        ^
In file included from ../include/iptables.h:5:0,
                 from m_ipt.c:18:
../include/xtables.h:34:29: fatal error: xtables-version.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'm_ipt.o' failed
make[1]: *** [m_ipt.o] Error 1
make[1]: *** Waiting for unfinished jobs....
rm emp_ematch.lex.c
make[1]: Leaving directory '/tmp/portage/sys-apps/iproute2-4.5.0/work/iproute2-4.5.0/tc'
Makefile:49: recipe for target 'all' failed
make: *** [all] Error 2
 * ERROR: sys-apps/iproute2-4.5.0::gentoo failed (compile phase):
 *   emake failed
Comment 1 Albert W. Hopkins 2016-03-15 11:56:33 UTC
Same issue.  This happens when iproute-4.5.0 is built with USE=-iptables.  A work-around is to build with USE=iptables.
Comment 2 Perfect Gentleman 2016-03-15 12:44:57 UTC
i use only USE=minimal
[ebuild     U  ] sys-apps/iproute2-4.5.0::gentoo [4.4.0::gentoo] USE="minimal -atm -berkdb -iptables -ipv6 (-selinux)" 542 KiB
Comment 3 Perfect Gentleman 2016-03-15 12:49:03 UTC
not '-minimal', but just 'minimal'
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2016-03-16 07:24:51 UTC
I wrote a mail to upstream regarding this problem and all I got as response was "patches welcome".
Comment 5 wjn 2016-03-17 04:20:11 UTC
I met same trouble.

Because iproute2 depends on iptables,
after installing iptables, compile will be work.
Upstream seems to want iptables installed.

But There are users who don't want to install iptables.
This (install iptables) workaround isn't the solution.

There should be the patch that drops iptables dependent codes.
Comment 6 Matt Whitlock 2016-03-17 13:38:18 UTC
Created attachment 428450 [details, diff]
iproute2-4.5.0-no-iptables.patch

1. Save the attached patch in /etc/portage/patches/sys-apps/iproute2-4.5.0/.

2. Create the file /etc/portage/env/sys-apps/iproute2-4.5.0 with these contents:

	pre_src_prepare() {
		epatch_user
	}

3. Retry to emerge =sys-apps/iproute2-4.5.0.
Comment 7 Albert W. Hopkins 2016-03-17 14:03:17 UTC
(In reply to Matt Whitlock from comment #6)
> Created attachment 428450 [details, diff] [details, diff]
> iproute2-4.5.0-no-iptables.patch

The patch worked for me. Thanks.

Interestingly enough, I'm now getting a similar issue with systemd.
Comment 8 Reuben Farrelly 2016-03-17 22:18:54 UTC
(In reply to Albert W. Hopkins from comment #7)
> (In reply to Matt Whitlock from comment #6)
> > Created attachment 428450 [details, diff] [details, diff] [details, diff]
> > iproute2-4.5.0-no-iptables.patch
> 
> The patch worked for me. Thanks.

+1.  Looks good here as well.  Thanks!
Comment 9 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2016-03-18 06:39:23 UTC
Matt, have you tried to submit this patch to upstream?
Comment 10 Matt Whitlock 2016-03-18 07:07:19 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #9)
> Matt, have you tried to submit this patch to upstream?

No, I haven't.

For what it's worth, if anyone tries to build iproute2 with my patch using linux-headers-4.5 but a supremely old version of iptables (such as is missing xtables), then I think they'll run into the same header snafu as reported in this bug. Hopefully everyone trying to build iproute2 with iptables support is using a modern version of iptables that includes xtables. (IMHO, upstream support for building with iptables but without xtables should be dropped.)
Comment 11 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2016-03-18 07:39:38 UTC
(In reply to Matt Whitlock from comment #10)
> (In reply to Lars Wendler (Polynomial-C) from comment #9)
> > Matt, have you tried to submit this patch to upstream?
> 
> No, I haven't.
> 
> For what it's worth, if anyone tries to build iproute2 with my patch using
> linux-headers-4.5 but a supremely old version of iptables (such as is
> missing xtables), then I think they'll run into the same header snafu as
> reported in this bug. Hopefully everyone trying to build iproute2 with
> iptables support is using a modern version of iptables that includes
> xtables. (IMHO, upstream support for building with iptables but without
> xtables should be dropped.)

Would you mind if I submit your patch upstream? I'd keep you as author of course and would also add your comment about iptables without xtables to the patch.
Comment 12 Matt Whitlock 2016-03-18 08:02:10 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #11)
> Would you mind if I submit your patch upstream? I'd keep you as author of
> course and would also add your comment about iptables without xtables to the
> patch.

Please do. Attribution not required.
Comment 13 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2016-03-18 09:17:36 UTC
Patch sent upstream. I'd like to wait for their feedback before I gonna add the patch to our tree.
Comment 14 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2016-03-21 17:35:21 UTC
*** Bug 577942 has been marked as a duplicate of this bug. ***
Comment 15 Brian Evans (RETIRED) gentoo-dev 2016-03-29 18:40:08 UTC
*** Bug 578540 has been marked as a duplicate of this bug. ***
Comment 16 Ben Kohler gentoo-dev 2016-04-17 16:19:33 UTC
Is it time to add this patch for ::gentoo?  I don't see any activity upstream, we're broken here for over a month now
Comment 17 William Hubbs gentoo-dev 2016-05-01 17:21:09 UTC
I would be cautious about adding a patch to Gentoo which hasn't been
accepted upstream. We don't know if they are working on another way to
handle the issue.
Comment 18 Matt Whitlock 2016-05-01 18:05:11 UTC
(In reply to William Hubbs from comment #17)
> I would be cautious about adding a patch to Gentoo which hasn't been
> accepted upstream. We don't know if they are working on another way to
> handle the issue.

Then Gentoo should remove "iptables" from IUSE and require iptables unconditionally because the build is broken right now. I personally don't like this, but it's preferable to the ebuild remaining broken in the tree.

If upstream is working on another solution, then couldn't we just put the patch in now with a comment to remind ourselves that the patch is just a temporary workaround, to be removed once upstream has implemented a fix?
Comment 19 Hanno Zysik (geki) 2016-05-15 09:58:34 UTC
Looks like linux-headers is going to include a libc workaround, see:
http://patchwork.ozlabs.org/patch/620262/

Also mentions a workaround for userspace code.
Comment 20 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2017-11-30 00:40:57 UTC
This was included in Gentoo's 4.5.0-4.8.0, and fixed upstream after that.
I confirm all of 4.12.0 - 4.14.1 compile correctly with USE=-iptables and no iptables present on the system.