Mailing List Archive

What is that (compile errors in system headers...)
Hi,

interesting...

I tried to compile a little program (nothing special) and got this
errors:

In file included from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
/usr/include/linux/types.h:27: error: previous declaration of 'dev_t' was here
/usr/include/sys/types.h:72: error: conflicting types for 'mode_t'
/usr/include/linux/types.h:33: error: previous declaration of 'mode_t' was here
/usr/include/sys/types.h:77: error: conflicting types for 'nlink_t'
/usr/include/linux/types.h:36: error: previous declaration of 'nlink_t' was here
In file included from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/time.h:105: error: conflicting types for 'timer_t'
/usr/include/linux/types.h:45: error: previous declaration of 'timer_t' was here
In file included from /usr/include/sys/types.h:220,
from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/sys/select.h:78: error: conflicting types for 'fd_set'
/usr/include/linux/types.h:24: error: previous declaration of 'fd_set' was here
In file included from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/sys/types.h:235: error: conflicting types for 'blkcnt_t'
/usr/include/linux/types.h:158: error: previous declaration of 'blkcnt_t' was here

Do I have shoot in one of my feet here ???

I am using vanilla kernel 2.6.18 on an up-to-date Gentoo linux...

All these errors seem not be dependant on my little program but seem
to be a misconfiguration on a very low level....

What should I do here ?

Thank you very much for any help in advance !

Keep hacking!
mcc
--
gentoo-user@gentoo.org mailing list
Re: What is that (compile errors in system headers...) [ In reply to ]
On Monday 02 October 2006 19:48, Meino Christian Cramer wrote:
> I tried to compile a little program (nothing special) and got this
> errors:
>
> In file included from /usr/include/stdlib.h:438,
> from ethlinkstat.c:10:
> /usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
> /usr/include/linux/types.h:27: error: previous declaration of 'dev_t'
[SNIP]
> What should I do here ?

Bug #144205 [1] should be of interest here. Basically you need to include
<sys/types.h> before <linux/types.h>.

[1] https://bugs.gentoo.org/show_bug.cgi?id=144205

--
Bo Andresen
Re: What is that (compile errors in system headers...) [ In reply to ]
From: Bo ├śrsted Andresen <bo.andresen@zlin.dk>
Subject: Re: [gentoo-user] What is that (compile errors in system headers...)
Date: Mon, 2 Oct 2006 19:58:57 +0200

> On Monday 02 October 2006 19:48, Meino Christian Cramer wrote:
> > I tried to compile a little program (nothing special) and got this
> > errors:
> >
> > In file included from /usr/include/stdlib.h:438,
> > from ethlinkstat.c:10:
> > /usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
> > /usr/include/linux/types.h:27: error: previous declaration of 'dev_t'
> [SNIP]
> > What should I do here ?
>
> Bug #144205 [1] should be of interest here. Basically you need to include
> <sys/types.h> before <linux/types.h>.
>
> [1] https://bugs.gentoo.org/show_bug.cgi?id=144205
>
> --
> Bo Andresen

Hi Bo,

thanks for your fast reply, but unfortunately it does not completely
solve it. Now I get this:

In file included from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/sys/types.h:62: error: conflicting types for 'dev_t'
/usr/include/linux/types.h:27: error: previous declaration of 'dev_t' was here
/usr/include/sys/types.h:72: error: conflicting types for 'mode_t'
/usr/include/linux/types.h:33: error: previous declaration of 'mode_t' was here
/usr/include/sys/types.h:77: error: conflicting types for 'nlink_t'
/usr/include/linux/types.h:36: error: previous declaration of 'nlink_t' was here
In file included from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/time.h:105: error: conflicting types for 'timer_t'
/usr/include/linux/types.h:45: error: previous declaration of 'timer_t' was here
In file included from /usr/include/sys/types.h:220,
from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/sys/select.h:78: error: conflicting types for 'fd_set'
/usr/include/linux/types.h:24: error: previous declaration of 'fd_set' was here
In file included from /usr/include/stdlib.h:438,
from ethlinkstat.c:10:
/usr/include/sys/types.h:235: error: conflicting types for 'blkcnt_t'
/usr/include/linux/types.h:158: error: previous declaration of 'blkcnt_t' was here
In file included from /usr/include/sys/uio.h:29,
from /usr/include/sys/socket.h:27,
from ethlinkstat.c:15:
/usr/include/bits/uio.h:43: error: redefinition of 'struct iovec'
In file included from /usr/include/sys/socket.h:35,
from ethlinkstat.c:15:
/usr/include/bits/socket.h:146: error: redefinition of 'struct sockaddr'
/usr/include/bits/socket.h:163: error: redefinition of 'struct __kernel_sockaddr_storage'
/usr/include/bits/socket.h:173: error: expected identifier before numeric constant
/usr/include/bits/socket.h:216: error: redefinition of 'struct msghdr'
/usr/include/bits/socket.h:231: error: redefinition of 'struct cmsghdr'
/usr/include/bits/socket.h:258: error: conflicting types for '__cmsg_nxthdr'
/usr/include/linux/socket.h:136: error: previous definition of '__cmsg_nxthdr' was here
/usr/include/bits/socket.h:286: error: expected identifier before numeric constant
/usr/include/bits/socket.h:297: error: redefinition of 'struct ucred'
/usr/include/bits/socket.h:309: error: redefinition of 'struct linger'


Something seems to be rotten in my system...
May be the linux kernel header files under /usr/linux and those of
linux-2.6.18 are incompatible ???

My includes are now:

#include <linux/if.h>
#include <linux/ethtool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <linux/types.h>
#include <sys/socket.h>

The program (a eth-link tester) is simply compiled with

make <program>

and I compile with gcc-4.1.1 (yse I did all the emerge system/world
thingies and beside of this everything works fine until
now). Compiling the kernel is as boring as ever ;O)


Keep hacking!
mcc




--
gentoo-user@gentoo.org mailing list
Re: What is that (compile errors in system headers...) [ In reply to ]
On Monday 02 October 2006 20:15, Meino Christian Cramer wrote:
[SNIP]
> My includes are now:
>
> #include <linux/if.h>
> #include <linux/ethtool.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <errno.h>
> #include <sys/types.h>
> #include <linux/types.h>
[SNIP]

# cat /usr/include/linux/if.h
[SNIP]
#include <linux/types.h> /* for "__kernel_caddr_t" et al */
[SNIP]

So as you see <linux/types.h> is included (by <linux/if.h> long before
<sys/types.h>....

--
Bo Andresen