uml fails to compile due to missing offsetof
I fail to see how arch/um/sys-i386/user-offsets.c can compile since offsetof() was declared __KERNEL__ only in include/linux/stddef.h. Does it work for anyone else? If so, is linux/stddef.h or /usr/include/linux/stddef.h used during compilation?
The x86_64 variant looks weird as well, linux/stddef.h is appearently included via some other headers.
Quoted 4 lines · Olaf Hering
I fail to see how
arch/um/sys-i386/user-offsets.ccan compile sinceoffsetof()was declared__KERNEL__only ininclude/linux/stddef.h. Does it work for anyone else?
It obviously works for me. offsetof is very standard C. I'd venture to say that a system which can't find it has a broken gcc installation.
Quoted 2 lines
If so, is
linux/stddef.hor/usr/include/linux/stddef.hused during compilation?
/usr/include/linux/stddef.h (but see below) - this is a userspace file, so it builds against libc headers.
Quoted 2 lines
The
x86_64variant looks weird as well,linux/stddef.his appearently included via some other headers.
Well, /usr/include/linux/stddef.h on my x86_64 box has no offsetof, despite being FC5 just like my i386 laptop. Yay for consistency.
However, there is a /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include/stddef.h which defines offsetof (and there's a corresponding file on my laptop), so I bet that's the true source of offsetof.
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com
Quoted 8 lines · Jeff Dike
Quoted 4 lines · Olaf Hering
I fail to see how
arch/um/sys-i386/user-offsets.ccan compile sinceoffsetof()was declared__KERNEL__only ininclude/linux/stddef.h. Does it work for anyone else?It obviously works for me. offsetof is very standard C. I'd venture to say that a system which can't find it has a broken gcc installation.
How do you get _STDDEF_H defined in /usr/lib/gcc/<target>/<vers>/include/stddef.h ?
For me _STDDEF_H remains undefined, and /usr/include/linux/stddef.h has offsetof inside __KERNEL__.
Quoted 6 lines
I fail to see how
arch/um/sys-i386/user-offsets.ccan compile sinceoffsetof()was declared__KERNEL__only ininclude/linux/stddef.h. Does it work for anyone else? If so, islinux/stddef.hor/usr/include/linux/stddef.hused during compilation?
Thex86_64variant looks weird as well,linux/stddef.his appearently included via some other headers.
Yes, the
#include <linux/stddef.h>
looks weird to me. AFAIK the C standard says that offsetof() comes from plain old <stddef.h>. Does the (untested) patch below fix the build for you?
arch/um/sys-i386/user-offsets.c +1 -1
@@ -2,7 +2,7 @@ #include <stdio.h>#include <signal.h> #include <asm/ptrace.h> #include <asm/user.h> -#include <linux/stddef.h> +#include <stddef.h> #include <sys/poll.h> #define DEFINE (sym, val) \
Quoted 3 lines · Roland Dreier
looks weird to me. AFAIK the C standard says that
offsetof()comes from plain old <stddef.h>. Does the (untested) patch below fix the build for you?
Yes, it does.
Quoted 4 lines · Olaf Hering
How do you get
_STDDEF_Hdefined in /usr/lib/gcc/<target>/<vers>/include/stddef.h ?
For me_STDDEF_Hremains undefined, and/usr/include/linux/stddef.hhas offsetof inside__KERNEL__.
I guess that the __KERNEL__ is your problem. I don't see that anything like that has any business being in the libc headers. In the other case of this that I looked at, the stuff in /usr/include/linux/ had been replaced by (or /usr/include/linux symlinked to) a kernel include/linux.
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com
Quoted 2 lines · Roland Dreier
looks weird to me. AFAIK the C standard says that
offsetof()comes from plain old <stddef.h>.
Yes, sorry.
Fixed in my tree, will be send to mainline shortly.
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com