Non-standard LFS v5-chap6: redefinition of `struct timespec´ compiling sysklogd-1.4.1

Ken Moffat ken at
Mon Jan 5 14:55:56 PST 2004

On Mon, 5 Jan 2004, Duarte Cordeiro wrote:

> I have all standard packages except for kernel-2.6.0 and module-init-tools
> While trying to compile sysklogd-1.4.1 I get the following error:
> gcc  -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DFSSTND  -c
> ksym_mod.c
> In file included from /usr/include/linux/timex.h:186,
>                  from /usr/include/linux/sched.h:11,
>                  from /usr/include/linux/module.h:10,
>                  from ksym_mod.c:96:
> /usr/include/linux/time.h:9: error: redefinition of `struct timespec'
> /usr/include/linux/time.h:15: error: redefinition of `struct timeval'
> In file included from /usr/include/linux/jiffies.h:6,
> ...
> And so on.
> I googled it and it's because I'm compiling it against kernel-2.6 headers.
> But now I'm puzzled.
> In the book I read the part that talks about:
> ---
> Why we copy the kernel headers and don't symlink them
> ---
> and that makes sense.
> But in the post that I found, it goes like this:
> -----------------------
> You've got /usr/src/linux-2.6.0-test7/include/linux as
> /usr/include/linux ? There's your problem, don't do that.
> There's only one app that has any business looking at kernel headers,
> and that's glibc. Even with glibc there's some debate as to whether it
> should be allowed to do so. When you compile glibc, configure it using
> --with-kernel=2.6.0 (I think that's the option) and tell it where to
> find the headers for your 2.6 kernel. That'll make you a glibc that's
> not backward compatible with anything prior to 2.6. Then the userspace
> headers it installs should be suitable for all your 2.6 compatible needs.
> Kernel people are most unforgiving of people who try to use the kernel
> headers in userspace and wind up with problems. Just ask google.
> ----------------------
> Who's right ? Who's wrong? Both rigth?

Both right. /usr/include/linux is for libc.  Anything else going there
will get burned, like sysklogd did.

> And the question is: how can I solve this ?

 You need "sanitised" headers.  Search the archives, particularly for
the lfs-hackers mailing list.  Maybe look at the nptl.txt hint as well.

Kryten: This is a job for Riviera Kid!

More information about the lfs-support mailing list