bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

struct ustat defined twice: gcc-3.3's include/linux/types.h and glibc-2.


From: Dan Kegel
Subject: struct ustat defined twice: gcc-3.3's include/linux/types.h and glibc-2.3.2's sysdeps/generic/bits/ustat.h
Date: Tue, 27 May 2003 14:48:14 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3

When I try to build glibc-2.3.2 with gcc-3.3 for sh4 using linux-2.4.19 headers,
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'
make[2]: *** 
[/home3/dank/crosstool/build/sh4-linux/gcc-3.3/build-glibc/misc/ustat.o] Error 1

GOTO Masanori wrote about this same error in March on linux.debian.maint.glibc, 
archived at
http://groups.google.com/groups?selm=20030322165012%247208%40gated-at.bofh.it
but didn't indicate it had been solved.

Here are the relevent bits of the preprocessor output for misc/ustat.c:

# 123 
"/home3/dank/crosstool/result/sh4-linux/gcc-3.3/sh4-linux/include/linux/types.h"
 3 4
struct ustat {
        __kernel_daddr_t f_tfree;
        __kernel_ino_t f_tinode;
        char f_fname[6];
        char f_fpack[6];
};

...

# 24 "../sysdeps/generic/bits/ustat.h" 2

struct ustat
  {
    __daddr_t f_tfree;
    __ino_t f_tinode;
    char f_fname[6];
    char f_fpack[6];
  };

There's a handy little algorithm for finding the sequence of includes that
got you to a certain point.  I applied it by hand, yielding the following:

# 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"
 3 4

That's what got the kernel's struct ustat defined, causing a clash with the 
later
definition of struct ustat by glibc.  (Has anyone written a perl script
to automate that algorithm?)

I suppose the 'right' fix would be to prepend __kernel_ in front
of the struct ustat declaration in gcc's copy of include/linux/types.h?
Or modify one of the headers to break the include chain that brought the
kernel's struct ustat in?

Suggestions welcome.

Thanks,
Dan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]