Mailing List Archive

compiling extension modules with -std=c99 fails
Hi

Is there any reason why compiling the iptables extensions should fail
when using -std=c99?

cc -O2 -Wall -Wunused
-I/usr/src/kernels/2.6.18-1.2798.fc6-i586/include -Iinclude/
-DIPTABLES_VERSION=\"1.3.5\"
-DIPT_LIB_DIR=\"/usr/local/lib/iptables\" -rdynamic -o iptables
iptables-standalone.c iptables.o libiptc/libiptc.a -ldl -lnsl -std=c99
In file included from include/libiptc/libiptc.h:6,
from include/iptables.h:5,
from iptables-standalone.c:38:
/usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/netfilter_ipv4/ip_tables.h:43:
error: IFNAMSIZ undeclared here (not in a function)


--
sashan
http://sashang.orcon.net.nz/
Re: compiling extension modules with -std=c99 fails [ In reply to ]
Lots of reasons.

What version of kernel development shipped with your distro?

What version of gcc are you using?

-gc

Sashan Govender wrote:
> Hi
>
> Is there any reason why compiling the iptables extensions should fail
> when using -std=c99?
>
> cc -O2 -Wall -Wunused
> -I/usr/src/kernels/2.6.18-1.2798.fc6-i586/include -Iinclude/
> -DIPTABLES_VERSION=\"1.3.5\"
> -DIPT_LIB_DIR=\"/usr/local/lib/iptables\" -rdynamic -o iptables
> iptables-standalone.c iptables.o libiptc/libiptc.a -ldl -lnsl -std=c99
> In file included from include/libiptc/libiptc.h:6,
> from include/iptables.h:5,
> from iptables-standalone.c:38:
> /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/netfilter_ipv4/ip_tables.h:43:
> error: IFNAMSIZ undeclared here (not in a function)
>
>
>
Re: compiling extension modules with -std=c99 fails [ In reply to ]
I've tried compiling it using 2.6.18 and 2.6.20. Using gcc (GCC) 4.1.1
20070105 (Red Hat 4.1.1-51). A patch to iptables like this:

--- kernel-2.6.20/linux-2.6.20/include/linux/netfilter_ipv4/ip_tables.h
2007-02-05 05:44:54.000000000 +1100
+++ kernel-2.6.20-skg/linux-2.6.20/include/linux/netfilter_ipv4/ip_tables.h
2007-07-31 14:22:41.000000000 +1000
@@ -16,7 +16,6 @@
#define _IPTABLES_H

#ifdef __KERNEL__
-#include <linux/if.h>
#include <linux/types.h>
#include <linux/in.h>
#include <linux/ip.h>
@@ -24,7 +23,7 @@
#endif
#include <linux/compiler.h>
#include <linux/netfilter_ipv4.h>
-
+#include <linux/if.h>
#include <linux/netfilter/x_tables.h>

#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN

allows me to compile the modules using -std=c99. The patch just
includes the file that contains the missing macro definition that gcc
was complaining about.

On 7/31/07, Gregory Carter <gcarter@aesgi.com> wrote:
> Lots of reasons.
>
> What version of kernel development shipped with your distro?
>
> What version of gcc are you using?
>
> -gc
>
> Sashan Govender wrote:
> > Hi
> >
> > Is there any reason why compiling the iptables extensions should fail
> > when using -std=c99?
> >
> > cc -O2 -Wall -Wunused
> > -I/usr/src/kernels/2.6.18-1.2798.fc6-i586/include -Iinclude/
> > -DIPTABLES_VERSION=\"1.3.5\"
> > -DIPT_LIB_DIR=\"/usr/local/lib/iptables\" -rdynamic -o iptables
> > iptables-standalone.c iptables.o libiptc/libiptc.a -ldl -lnsl -std=c99
> > In file included from include/libiptc/libiptc.h:6,
> > from include/iptables.h:5,
> > from iptables-standalone.c:38:
> > /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux/netfilter_ipv4/ip_tables.h:43:
> > error: IFNAMSIZ undeclared here (not in a function)
> >
> >
> >
>