struct ustat defined twice: gcc-3.3's include/linux/types.h and glibc-2.3.2's sysdeps/generic/bits/ustat.h

Dan Kegel dkegel@ixiacom.com
Wed May 28 01:37:00 GMT 2003


Dan Kegel wrote:
> When I try to build glibc-2.3.2 with gcc-3.3 for sh4 ...,
> I get the following error:
> 
> In file included from sys/ustat.h:30,
>                  from ../sysdeps/unix/sysv/linux/ustat.c:21:
> ../sysdeps/generic/bits/ustat.h:26: error: redefinition of `struct ustat'...
> 
> [The include chain causing the initial definition is:]
> 
> # 20 "../sysdeps/unix/sysv/linux/ustat.c"
> # 22 "../include/errno.h"
> # 1 "../include/tls.h" 1
> # 125 "../linuxthreads/sysdeps/sh/tls.h"
> # 26 "../linuxthreads/descr.h" 2
> # 7 "../linuxthreads_db/thread_dbP.h" 2
> # 20 "../linuxthreads_db/proc_service.h"
> # 30 "../sysdeps/unix/sysv/linux/sys/procfs.h" 2
> # 24 "../sysdeps/unix/sysv/linux/sh/sys/user.h"
> # 1 
> "/home3/dank/crosstool/result/sh4-linux/gcc-3.3/sh4-linux/include/asm/user.h" 
> 1 3 4
> # 123 
> "/home3/dank/crosstool/result/sh4-linux/gcc-3.3/sh4-linux/include/linux/types.h" 
> ...

It looks like the problem may have been introduced with this change to libc's errno.h:

http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/include/errno.h.diff?r1=1.4&r2=1.5&cvsroot=glibc&f=h

2002-07-30  Roland McGrath  <roland@redhat.com>
	* include/errno.h: Include <tls.h> to make sure USE_TLS defined by the
	time we test it.
	* include/errno.h: Protect from multiple inclusion.

Before that change, errno.h did not include tls.h.

And sure enough, only the two architectures that fail to build have
an include of asm/user.h from inside their sys/user.h:

dank@dank:~/glibc-2.3.2/sysdeps/unix/sysv/linux$ grep asm.user.h */sys/user.h
s390/sys/user.h:#include <asm/user.h>
sh/sys/user.h:#include <asm/user.h>

All other sys/user.h's have the comment

/* The whole purpose of this file is for GDB and GDB only.  Don't read
    too much into it.  Don't use it for anything other than GDB unless
    you know what you are doing.  */

and avoid including asm/user.h.

So it looks like the right fix is to replace the #includes in
{s390,sh}/sys/user.h with a simple definition of struct user and
any associated constants and types needed by gdb.

- Dan


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list