public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* uml fails to compile due to missing offsetof
@ 2006-11-19 12:00 Olaf Hering
  2006-11-19 14:25 ` Jeff Dike
  2006-11-19 17:08 ` Roland Dreier
  0 siblings, 2 replies; 7+ messages in thread
From: Olaf Hering @ 2006-11-19 12:00 UTC (permalink / raw)
  To: linux-kernel


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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uml fails to compile due to missing offsetof
  2006-11-19 12:00 uml fails to compile due to missing offsetof Olaf Hering
@ 2006-11-19 14:25 ` Jeff Dike
  2006-11-19 15:58   ` Olaf Hering
  2006-11-19 17:08 ` Roland Dreier
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Dike @ 2006-11-19 14:25 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel

On Sun, Nov 19, 2006 at 01:00:01PM +0100, Olaf Hering wrote:
> 
> 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? 

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.

> If so, is linux/stddef.h or /usr/include/linux/stddef.h used during
> compilation?

/usr/include/linux/stddef.h (but see below) - this is a userspace
file, so it builds against libc headers.

> The x86_64 variant looks weird as well, linux/stddef.h is 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
-- 
Work email - jdike at linux dot intel dot com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uml fails to compile due to missing offsetof
  2006-11-19 14:25 ` Jeff Dike
@ 2006-11-19 15:58   ` Olaf Hering
  2006-11-19 19:35     ` Jeff Dike
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2006-11-19 15:58 UTC (permalink / raw)
  To: Jeff Dike; +Cc: linux-kernel

On Sun, Nov 19, Jeff Dike wrote:

> On Sun, Nov 19, 2006 at 01:00:01PM +0100, Olaf Hering wrote:
> > 
> > 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? 
> 
> 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__.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uml fails to compile due to missing offsetof
  2006-11-19 12:00 uml fails to compile due to missing offsetof Olaf Hering
  2006-11-19 14:25 ` Jeff Dike
@ 2006-11-19 17:08 ` Roland Dreier
  2006-11-19 17:20   ` Olaf Hering
  2006-11-19 19:38   ` Jeff Dike
  1 sibling, 2 replies; 7+ messages in thread
From: Roland Dreier @ 2006-11-19 17:08 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel

 > 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.

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?

diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 6f4ef2b..447306b 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -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) \

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: uml fails to compile due to missing offsetof
  2006-11-19 17:08 ` Roland Dreier
@ 2006-11-19 17:20   ` Olaf Hering
  2006-11-19 19:38   ` Jeff Dike
  1 sibling, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2006-11-19 17:20 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-kernel

On Sun, Nov 19, Roland Dreier wrote:

> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uml fails to compile due to missing offsetof
  2006-11-19 15:58   ` Olaf Hering
@ 2006-11-19 19:35     ` Jeff Dike
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Dike @ 2006-11-19 19:35 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linux-kernel

On Sun, Nov 19, 2006 at 04:58:47PM +0100, Olaf Hering wrote:
> 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__.

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
-- 
Work email - jdike at linux dot intel dot com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: uml fails to compile due to missing offsetof
  2006-11-19 17:08 ` Roland Dreier
  2006-11-19 17:20   ` Olaf Hering
@ 2006-11-19 19:38   ` Jeff Dike
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Dike @ 2006-11-19 19:38 UTC (permalink / raw)
  To: Roland Dreier; +Cc: Olaf Hering, linux-kernel

On Sun, Nov 19, 2006 at 09:08:47AM -0800, Roland Dreier wrote:
> 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
-- 
Work email - jdike at linux dot intel dot com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-11-19 19:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-19 12:00 uml fails to compile due to missing offsetof Olaf Hering
2006-11-19 14:25 ` Jeff Dike
2006-11-19 15:58   ` Olaf Hering
2006-11-19 19:35     ` Jeff Dike
2006-11-19 17:08 ` Roland Dreier
2006-11-19 17:20   ` Olaf Hering
2006-11-19 19:38   ` Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox