All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
@ 2017-12-01 11:04 Leon Romanovsky
  2017-12-01 16:48 ` Stephen Hemminger
  2017-12-06  1:33 ` Stephen Hemminger
  0 siblings, 2 replies; 8+ messages in thread
From: Leon Romanovsky @ 2017-12-01 11:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Leon Romanovsky, Riad Abo Raed, Guy Ergas

From: Leon Romanovsky <leonro@mellanox.com>

Add asm/posix_types.h header file to the list of needed includes,
because the headers files in RHEL 6.8 are too old and doesn't
have declaration of __kernel_long_t.

In file included from ../include/uapi/linux/kernel.h:5,
                 from ../include/uapi/linux/netfilter/x_tables.h:4,
                 from ../include/xtables.h:20,
                 from em_ipset.c:26:
../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’

Cc: Riad Abo Raed <riada@mellanox.com>
Cc: Guy Ergas <guye@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
Stephen,
I don't know how to properly solve this type of errors and would like to
hear your guidance on it.

Should I simply add kernel file? Or maybe I need to add HAVE_xxx checks
to configure script to check __kernel_long_t existence and declare only
this type?

I also have another build error on RHEL 6.8 system and looking for a
solution.

In file included from em_ipset.c:26:
../include/xtables.h:35:29: error: xtables-version.h: No such file or directory
make[1]: *** [em_ipset.o] Error 1

The iptables-devel is iptables-devel-1.4.7-16.el6.x86_64 so check_xt()
success, but RH headers don't have xtable-version.h and the relevant defines
are embedded in the main xtables.h header file.

Thanks
---
 include/uapi/asm/posix_types.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 include/uapi/asm/posix_types.h

diff --git a/include/uapi/asm/posix_types.h b/include/uapi/asm/posix_types.h
new file mode 100644
index 00000000..5e6ea22b
--- /dev/null
+++ b/include/uapi/asm/posix_types.h
@@ -0,0 +1,97 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __ASM_GENERIC_POSIX_TYPES_H
+#define __ASM_GENERIC_POSIX_TYPES_H
+
+#include <asm/bitsperlong.h>
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.
+ *
+ * First the types that are often defined in different ways across
+ * architectures, so that you can override them.
+ */
+
+#ifndef __kernel_long_t
+typedef long		__kernel_long_t;
+typedef unsigned long	__kernel_ulong_t;
+#endif
+
+#ifndef __kernel_ino_t
+typedef __kernel_ulong_t __kernel_ino_t;
+#endif
+
+#ifndef __kernel_mode_t
+typedef unsigned int	__kernel_mode_t;
+#endif
+
+#ifndef __kernel_pid_t
+typedef int		__kernel_pid_t;
+#endif
+
+#ifndef __kernel_ipc_pid_t
+typedef int		__kernel_ipc_pid_t;
+#endif
+
+#ifndef __kernel_uid_t
+typedef unsigned int	__kernel_uid_t;
+typedef unsigned int	__kernel_gid_t;
+#endif
+
+#ifndef __kernel_suseconds_t
+typedef __kernel_long_t		__kernel_suseconds_t;
+#endif
+
+#ifndef __kernel_daddr_t
+typedef int		__kernel_daddr_t;
+#endif
+
+#ifndef __kernel_uid32_t
+typedef unsigned int	__kernel_uid32_t;
+typedef unsigned int	__kernel_gid32_t;
+#endif
+
+#ifndef __kernel_old_uid_t
+typedef __kernel_uid_t	__kernel_old_uid_t;
+typedef __kernel_gid_t	__kernel_old_gid_t;
+#endif
+
+#ifndef __kernel_old_dev_t
+typedef unsigned int	__kernel_old_dev_t;
+#endif
+
+/*
+ * Most 32 bit architectures use "unsigned int" size_t,
+ * and all 64 bit architectures use "unsigned long" size_t.
+ */
+#ifndef __kernel_size_t
+#if __BITS_PER_LONG != 64
+typedef unsigned int	__kernel_size_t;
+typedef int		__kernel_ssize_t;
+typedef int		__kernel_ptrdiff_t;
+#else
+typedef __kernel_ulong_t __kernel_size_t;
+typedef __kernel_long_t	__kernel_ssize_t;
+typedef __kernel_long_t	__kernel_ptrdiff_t;
+#endif
+#endif
+
+#ifndef __kernel_fsid_t
+typedef struct {
+	int	val[2];
+} __kernel_fsid_t;
+#endif
+
+/*
+ * anything below here should be completely generic
+ */
+typedef __kernel_long_t	__kernel_off_t;
+typedef long long	__kernel_loff_t;
+typedef __kernel_long_t	__kernel_time_t;
+typedef __kernel_long_t	__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
+typedef char *		__kernel_caddr_t;
+typedef unsigned short	__kernel_uid16_t;
+typedef unsigned short	__kernel_gid16_t;
+
+#endif /* __ASM_GENERIC_POSIX_TYPES_H */

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-01 11:04 [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8 Leon Romanovsky
@ 2017-12-01 16:48 ` Stephen Hemminger
  2017-12-01 19:56   ` Michal Kubecek
  2017-12-02  8:28   ` Leon Romanovsky
  2017-12-06  1:33 ` Stephen Hemminger
  1 sibling, 2 replies; 8+ messages in thread
From: Stephen Hemminger @ 2017-12-01 16:48 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev, Leon Romanovsky, Riad Abo Raed, Guy Ergas

On Fri,  1 Dec 2017 13:04:51 +0200
Leon Romanovsky <leon@kernel.org> wrote:

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Add asm/posix_types.h header file to the list of needed includes,
> because the headers files in RHEL 6.8 are too old and doesn't
> have declaration of __kernel_long_t.
> 
> In file included from ../include/uapi/linux/kernel.h:5,
>                  from ../include/uapi/linux/netfilter/x_tables.h:4,
>                  from ../include/xtables.h:20,
>                  from em_ipset.c:26:
> ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> 
> Cc: Riad Abo Raed <riada@mellanox.com>
> Cc: Guy Ergas <guye@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

I see the problem, but the solution of dragging in posix_types.h
would be too much of a long term maintenance issue.
All the headers in uapi are regularly generated from upstream
kernel headers; I don't want to start making exceptions.

Is it just the xtables stuff (which has always been problematic)?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-01 16:48 ` Stephen Hemminger
@ 2017-12-01 19:56   ` Michal Kubecek
  2017-12-02  8:22     ` Leon Romanovsky
  2017-12-02  8:28   ` Leon Romanovsky
  1 sibling, 1 reply; 8+ messages in thread
From: Michal Kubecek @ 2017-12-01 19:56 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Leon Romanovsky, netdev, Leon Romanovsky, Riad Abo Raed, Guy Ergas

On Fri, Dec 01, 2017 at 08:48:07AM -0800, Stephen Hemminger wrote:
> On Fri,  1 Dec 2017 13:04:51 +0200
> Leon Romanovsky <leon@kernel.org> wrote:
> 
> > From: Leon Romanovsky <leonro@mellanox.com>
> > 
> > Add asm/posix_types.h header file to the list of needed includes,
> > because the headers files in RHEL 6.8 are too old and doesn't
> > have declaration of __kernel_long_t.
> > 
> > In file included from ../include/uapi/linux/kernel.h:5,
> >                  from ../include/uapi/linux/netfilter/x_tables.h:4,
> >                  from ../include/xtables.h:20,
> >                  from em_ipset.c:26:
> > ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> > 
> > Cc: Riad Abo Raed <riada@mellanox.com>
> > Cc: Guy Ergas <guye@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> 
> I see the problem, but the solution of dragging in posix_types.h
> would be too much of a long term maintenance issue.
> All the headers in uapi are regularly generated from upstream
> kernel headers; I don't want to start making exceptions.
> 
> Is it just the xtables stuff (which has always been problematic)?

Actually, the only place where __kernel_long_t and __kernel_ulong_t
appear is struct sysinfo in include/uapi/linux/sysinfo.h and this
structure isn't even used anywhere in iproute2 source (not even in the
include/uapi/linux/kernel.h file which includes <linux/sysinfo.h>).

So one could work around the problem by defining _LINUX_SYSINFO_H but
that seems a bit dirty hack.

Michal Kubecek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-01 19:56   ` Michal Kubecek
@ 2017-12-02  8:22     ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2017-12-02  8:22 UTC (permalink / raw)
  To: Michal Kubecek; +Cc: Stephen Hemminger, netdev, Riad Abo Raed, Guy Ergas

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

On Fri, Dec 01, 2017 at 08:56:24PM +0100, Michal Kubecek wrote:
> On Fri, Dec 01, 2017 at 08:48:07AM -0800, Stephen Hemminger wrote:
> > On Fri,  1 Dec 2017 13:04:51 +0200
> > Leon Romanovsky <leon@kernel.org> wrote:
> >
> > > From: Leon Romanovsky <leonro@mellanox.com>
> > >
> > > Add asm/posix_types.h header file to the list of needed includes,
> > > because the headers files in RHEL 6.8 are too old and doesn't
> > > have declaration of __kernel_long_t.
> > >
> > > In file included from ../include/uapi/linux/kernel.h:5,
> > >                  from ../include/uapi/linux/netfilter/x_tables.h:4,
> > >                  from ../include/xtables.h:20,
> > >                  from em_ipset.c:26:
> > > ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> > >
> > > Cc: Riad Abo Raed <riada@mellanox.com>
> > > Cc: Guy Ergas <guye@mellanox.com>
> > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> >
> > I see the problem, but the solution of dragging in posix_types.h
> > would be too much of a long term maintenance issue.
> > All the headers in uapi are regularly generated from upstream
> > kernel headers; I don't want to start making exceptions.
> >
> > Is it just the xtables stuff (which has always been problematic)?
>
> Actually, the only place where __kernel_long_t and __kernel_ulong_t
> appear is struct sysinfo in include/uapi/linux/sysinfo.h and this
> structure isn't even used anywhere in iproute2 source (not even in the
> include/uapi/linux/kernel.h file which includes <linux/sysinfo.h>).
>
> So one could work around the problem by defining _LINUX_SYSINFO_H but
> that seems a bit dirty hack.

It is too dirty :). It can cause to completely unpredictable compilation
failures in the future, which won't be easy to track down.

>
> Michal Kubecek
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-01 16:48 ` Stephen Hemminger
  2017-12-01 19:56   ` Michal Kubecek
@ 2017-12-02  8:28   ` Leon Romanovsky
  2017-12-06  0:59     ` Stephen Hemminger
  1 sibling, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2017-12-02  8:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Riad Abo Raed, Guy Ergas

[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]

On Fri, Dec 01, 2017 at 08:48:07AM -0800, Stephen Hemminger wrote:
> On Fri,  1 Dec 2017 13:04:51 +0200
> Leon Romanovsky <leon@kernel.org> wrote:
>
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Add asm/posix_types.h header file to the list of needed includes,
> > because the headers files in RHEL 6.8 are too old and doesn't
> > have declaration of __kernel_long_t.
> >
> > In file included from ../include/uapi/linux/kernel.h:5,
> >                  from ../include/uapi/linux/netfilter/x_tables.h:4,
> >                  from ../include/xtables.h:20,
> >                  from em_ipset.c:26:
> > ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> >
> > Cc: Riad Abo Raed <riada@mellanox.com>
> > Cc: Guy Ergas <guye@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>
> I see the problem, but the solution of dragging in posix_types.h
> would be too much of a long term maintenance issue.
> All the headers in uapi are regularly generated from upstream
> kernel headers; I don't want to start making exceptions.
>
> Is it just the xtables stuff (which has always been problematic)?

Yes, both failures are related to xtables. And this wass my naive approach to
solve first one, the second mentioned in the original commit log
(missing xtables-version.h) is more harder to fix.

Will it work if I test in configure script the existence of __kernel_long_t
and fallback to xt-internal.h?

Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-02  8:28   ` Leon Romanovsky
@ 2017-12-06  0:59     ` Stephen Hemminger
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2017-12-06  0:59 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev, Riad Abo Raed, Guy Ergas

[-- Attachment #1: Type: text/plain, Size: 1814 bytes --]

On Sat, 2 Dec 2017 10:28:33 +0200
Leon Romanovsky <leon@kernel.org> wrote:

> On Fri, Dec 01, 2017 at 08:48:07AM -0800, Stephen Hemminger wrote:
> > On Fri,  1 Dec 2017 13:04:51 +0200
> > Leon Romanovsky <leon@kernel.org> wrote:
> >  
> > > From: Leon Romanovsky <leonro@mellanox.com>
> > >
> > > Add asm/posix_types.h header file to the list of needed includes,
> > > because the headers files in RHEL 6.8 are too old and doesn't
> > > have declaration of __kernel_long_t.
> > >
> > > In file included from ../include/uapi/linux/kernel.h:5,
> > >                  from ../include/uapi/linux/netfilter/x_tables.h:4,
> > >                  from ../include/xtables.h:20,
> > >                  from em_ipset.c:26:
> > > ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> > >
> > > Cc: Riad Abo Raed <riada@mellanox.com>
> > > Cc: Guy Ergas <guye@mellanox.com>
> > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>  
> >
> > I see the problem, but the solution of dragging in posix_types.h
> > would be too much of a long term maintenance issue.
> > All the headers in uapi are regularly generated from upstream
> > kernel headers; I don't want to start making exceptions.
> >
> > Is it just the xtables stuff (which has always been problematic)?  
> 
> Yes, both failures are related to xtables. And this wass my naive approach to
> solve first one, the second mentioned in the original commit log
> (missing xtables-version.h) is more harder to fix.
> 
> Will it work if I test in configure script the existence of __kernel_long_t
> and fallback to xt-internal.h?
> 
> Thanks

Why not just modify the part of the configure script that checks if xtables build will
work. It should fail if header files won't work.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-01 11:04 [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8 Leon Romanovsky
  2017-12-01 16:48 ` Stephen Hemminger
@ 2017-12-06  1:33 ` Stephen Hemminger
  2017-12-06  5:01   ` Leon Romanovsky
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2017-12-06  1:33 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev, Leon Romanovsky, Riad Abo Raed, Guy Ergas

On Fri,  1 Dec 2017 13:04:51 +0200
Leon Romanovsky <leon@kernel.org> wrote:

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Add asm/posix_types.h header file to the list of needed includes,
> because the headers files in RHEL 6.8 are too old and doesn't
> have declaration of __kernel_long_t.
> 
> In file included from ../include/uapi/linux/kernel.h:5,
>                  from ../include/uapi/linux/netfilter/x_tables.h:4,
>                  from ../include/xtables.h:20,
>                  from em_ipset.c:26:
> ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> 
> Cc: Riad Abo Raed <riada@mellanox.com>
> Cc: Guy Ergas <guye@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> Stephen,
> I don't know how to properly solve this type of errors and would like to
> hear your guidance on it.
> 
> Should I simply add kernel file? Or maybe I need to add HAVE_xxx checks
> to configure script to check __kernel_long_t existence and declare only
> this type?
> 
> I also have another build error on RHEL 6.8 system and looking for a
> solution.
> 
> In file included from em_ipset.c:26:
> ../include/xtables.h:35:29: error: xtables-version.h: No such file or directory
> make[1]: *** [em_ipset.o] Error 1
> 
> The iptables-devel is iptables-devel-1.4.7-16.el6.x86_64 so check_xt()
> success, but RH headers don't have xtable-version.h and the relevant defines
> are embedded in the main xtables.h header file.
> 
> Thanks
> ---
>  include/uapi/asm/posix_types.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 97 insertions(+)
>  create mode 100644 include/uapi/asm/posix_types.h
> 
> diff --git a/include/uapi/asm/posix_types.h b/include/uapi/asm/posix_types.h
> new file mode 100644
> index 00000000..5e6ea22b
> --- /dev/null
> +++ b/include/uapi/asm/posix_types.h
> @@ -0,0 +1,97 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef __ASM_GENERIC_POSIX_TYPES_H
> +#define __ASM_GENERIC_POSIX_TYPES_H
> +
> +#include <asm/bitsperlong.h>
> +/*
> + * This file is generally used by user-level software, so you need to
> + * be a little careful about namespace pollution etc.
> + *
> + * First the types that are often defined in different ways across
> + * architectures, so that you can override them.
> + */
> +
> +#ifndef __kernel_long_t
> +typedef long		__kernel_long_t;
> +typedef unsigned long	__kernel_ulong_t;
> +#endif
> +
> +#ifndef __kernel_ino_t
> +typedef __kernel_ulong_t __kernel_ino_t;
> +#endif
> +
> +#ifndef __kernel_mode_t
> +typedef unsigned int	__kernel_mode_t;
> +#endif
> +
> +#ifndef __kernel_pid_t
> +typedef int		__kernel_pid_t;
> +#endif
> +
> +#ifndef __kernel_ipc_pid_t
> +typedef int		__kernel_ipc_pid_t;
> +#endif
> +
> +#ifndef __kernel_uid_t
> +typedef unsigned int	__kernel_uid_t;
> +typedef unsigned int	__kernel_gid_t;
> +#endif
> +
> +#ifndef __kernel_suseconds_t
> +typedef __kernel_long_t		__kernel_suseconds_t;
> +#endif
> +
> +#ifndef __kernel_daddr_t
> +typedef int		__kernel_daddr_t;
> +#endif
> +
> +#ifndef __kernel_uid32_t
> +typedef unsigned int	__kernel_uid32_t;
> +typedef unsigned int	__kernel_gid32_t;
> +#endif
> +
> +#ifndef __kernel_old_uid_t
> +typedef __kernel_uid_t	__kernel_old_uid_t;
> +typedef __kernel_gid_t	__kernel_old_gid_t;
> +#endif
> +
> +#ifndef __kernel_old_dev_t
> +typedef unsigned int	__kernel_old_dev_t;
> +#endif
> +
> +/*
> + * Most 32 bit architectures use "unsigned int" size_t,
> + * and all 64 bit architectures use "unsigned long" size_t.
> + */
> +#ifndef __kernel_size_t
> +#if __BITS_PER_LONG != 64
> +typedef unsigned int	__kernel_size_t;
> +typedef int		__kernel_ssize_t;
> +typedef int		__kernel_ptrdiff_t;
> +#else
> +typedef __kernel_ulong_t __kernel_size_t;
> +typedef __kernel_long_t	__kernel_ssize_t;
> +typedef __kernel_long_t	__kernel_ptrdiff_t;
> +#endif
> +#endif
> +
> +#ifndef __kernel_fsid_t
> +typedef struct {
> +	int	val[2];
> +} __kernel_fsid_t;
> +#endif
> +
> +/*
> + * anything below here should be completely generic
> + */
> +typedef __kernel_long_t	__kernel_off_t;
> +typedef long long	__kernel_loff_t;
> +typedef __kernel_long_t	__kernel_time_t;
> +typedef __kernel_long_t	__kernel_clock_t;
> +typedef int		__kernel_timer_t;
> +typedef int		__kernel_clockid_t;
> +typedef char *		__kernel_caddr_t;
> +typedef unsigned short	__kernel_uid16_t;
> +typedef unsigned short	__kernel_gid16_t;
> +
> +#endif /* __ASM_GENERIC_POSIX_TYPES_H */
> --
> 2.15.1
> 

This isn't going to be supportable.  The headers in uapi are updated by
a script from kernel, and this version posix_types.h conflicts with what
the kernel creates by make headers_install.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8
  2017-12-06  1:33 ` Stephen Hemminger
@ 2017-12-06  5:01   ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2017-12-06  5:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Riad Abo Raed, Guy Ergas

On Tue, Dec 05, 2017 at 05:33:25PM -0800, Stephen Hemminger wrote:
> On Fri,  1 Dec 2017 13:04:51 +0200
> Leon Romanovsky <leon@kernel.org> wrote:
>
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Add asm/posix_types.h header file to the list of needed includes,
> > because the headers files in RHEL 6.8 are too old and doesn't
> > have declaration of __kernel_long_t.
> >
> > In file included from ../include/uapi/linux/kernel.h:5,
> >                  from ../include/uapi/linux/netfilter/x_tables.h:4,
> >                  from ../include/xtables.h:20,
> >                  from em_ipset.c:26:
> > ../include/uapi/linux/sysinfo.h:9: error: expected specifier-qualifier-list before ‘__kernel_long_t’
> >
> > Cc: Riad Abo Raed <riada@mellanox.com>
> > Cc: Guy Ergas <guye@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > Stephen,
> > I don't know how to properly solve this type of errors and would like to
> > hear your guidance on it.
> >
> > Should I simply add kernel file? Or maybe I need to add HAVE_xxx checks
> > to configure script to check __kernel_long_t existence and declare only
> > this type?
> >
> > I also have another build error on RHEL 6.8 system and looking for a
> > solution.
> >
> > In file included from em_ipset.c:26:
> > ../include/xtables.h:35:29: error: xtables-version.h: No such file or directory
> > make[1]: *** [em_ipset.o] Error 1
> >
> > The iptables-devel is iptables-devel-1.4.7-16.el6.x86_64 so check_xt()
> > success, but RH headers don't have xtable-version.h and the relevant defines
> > are embedded in the main xtables.h header file.
> >
> > Thanks
> > ---
> >  include/uapi/asm/posix_types.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 97 insertions(+)
> >  create mode 100644 include/uapi/asm/posix_types.h
> >
> > diff --git a/include/uapi/asm/posix_types.h b/include/uapi/asm/posix_types.h
> > new file mode 100644
> > index 00000000..5e6ea22b
> > --- /dev/null
> > +++ b/include/uapi/asm/posix_types.h
> > @@ -0,0 +1,97 @@
> > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> > +#ifndef __ASM_GENERIC_POSIX_TYPES_H
> > +#define __ASM_GENERIC_POSIX_TYPES_H
> > +
> > +#include <asm/bitsperlong.h>
> > +/*
> > + * This file is generally used by user-level software, so you need to
> > + * be a little careful about namespace pollution etc.
> > + *
> > + * First the types that are often defined in different ways across
> > + * architectures, so that you can override them.
> > + */
> > +
> > +#ifndef __kernel_long_t
> > +typedef long		__kernel_long_t;
> > +typedef unsigned long	__kernel_ulong_t;
> > +#endif
> > +
> > +#ifndef __kernel_ino_t
> > +typedef __kernel_ulong_t __kernel_ino_t;
> > +#endif
> > +
> > +#ifndef __kernel_mode_t
> > +typedef unsigned int	__kernel_mode_t;
> > +#endif
> > +
> > +#ifndef __kernel_pid_t
> > +typedef int		__kernel_pid_t;
> > +#endif
> > +
> > +#ifndef __kernel_ipc_pid_t
> > +typedef int		__kernel_ipc_pid_t;
> > +#endif
> > +
> > +#ifndef __kernel_uid_t
> > +typedef unsigned int	__kernel_uid_t;
> > +typedef unsigned int	__kernel_gid_t;
> > +#endif
> > +
> > +#ifndef __kernel_suseconds_t
> > +typedef __kernel_long_t		__kernel_suseconds_t;
> > +#endif
> > +
> > +#ifndef __kernel_daddr_t
> > +typedef int		__kernel_daddr_t;
> > +#endif
> > +
> > +#ifndef __kernel_uid32_t
> > +typedef unsigned int	__kernel_uid32_t;
> > +typedef unsigned int	__kernel_gid32_t;
> > +#endif
> > +
> > +#ifndef __kernel_old_uid_t
> > +typedef __kernel_uid_t	__kernel_old_uid_t;
> > +typedef __kernel_gid_t	__kernel_old_gid_t;
> > +#endif
> > +
> > +#ifndef __kernel_old_dev_t
> > +typedef unsigned int	__kernel_old_dev_t;
> > +#endif
> > +
> > +/*
> > + * Most 32 bit architectures use "unsigned int" size_t,
> > + * and all 64 bit architectures use "unsigned long" size_t.
> > + */
> > +#ifndef __kernel_size_t
> > +#if __BITS_PER_LONG != 64
> > +typedef unsigned int	__kernel_size_t;
> > +typedef int		__kernel_ssize_t;
> > +typedef int		__kernel_ptrdiff_t;
> > +#else
> > +typedef __kernel_ulong_t __kernel_size_t;
> > +typedef __kernel_long_t	__kernel_ssize_t;
> > +typedef __kernel_long_t	__kernel_ptrdiff_t;
> > +#endif
> > +#endif
> > +
> > +#ifndef __kernel_fsid_t
> > +typedef struct {
> > +	int	val[2];
> > +} __kernel_fsid_t;
> > +#endif
> > +
> > +/*
> > + * anything below here should be completely generic
> > + */
> > +typedef __kernel_long_t	__kernel_off_t;
> > +typedef long long	__kernel_loff_t;
> > +typedef __kernel_long_t	__kernel_time_t;
> > +typedef __kernel_long_t	__kernel_clock_t;
> > +typedef int		__kernel_timer_t;
> > +typedef int		__kernel_clockid_t;
> > +typedef char *		__kernel_caddr_t;
> > +typedef unsigned short	__kernel_uid16_t;
> > +typedef unsigned short	__kernel_gid16_t;
> > +
> > +#endif /* __ASM_GENERIC_POSIX_TYPES_H */
> > --
> > 2.15.1
> >
>
> This isn't going to be supportable.  The headers in uapi are updated by
> a script from kernel, and this version posix_types.h conflicts with what
> the kernel creates by make headers_install.

At the end, I gave up to fix compilation properly for RHEL 6.8.
After I fixed posix_type and xt-tables, I discovered that glibc headers
are not updated too (missing AF_VSOCK).

My dirty hack was to copy various headers to iproute2 so verification
team can proceed with latest iproute2 on such platform was enough for
them.

Thanks

>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-06  5:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 11:04 [PATCH iproute2] iproute2: Fix undeclared __kernel_long_t type build error in RHEL 6.8 Leon Romanovsky
2017-12-01 16:48 ` Stephen Hemminger
2017-12-01 19:56   ` Michal Kubecek
2017-12-02  8:22     ` Leon Romanovsky
2017-12-02  8:28   ` Leon Romanovsky
2017-12-06  0:59     ` Stephen Hemminger
2017-12-06  1:33 ` Stephen Hemminger
2017-12-06  5:01   ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.