Where does crosstool get its "kernel" includes?

Daniel Kegel dank@kegel.com
Wed Sep 15 18:02:00 GMT 2004


Marius Groeger wrote:
>> /usr/include/linux/list.h:682:2: #warning "don't include kernel headers in userspace"
>> ...
> 
> Well, this application evidently throws __KERNEL__, so my fix would
> be somewhere in the application, not the headers.

I don't think so... as far as I can tell, the apps in question don't define __KERNEL__.
I did find one that does: mplayer.
mplayer-1.0pre1/libdha/kernelhelper/dhahelper.c

In fact, searching for that error message seems to be a pretty good way
to find people who are having trouble building apps with kernel headers!
e.g.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=216921
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=220138
http://www.linuxquestions.org/questions/showthread.php?s=&threadid=223561
http://lists.infradead.org/pipermail/linux-pcmcia/2003-April/000010.html

>> Are you submitting patches to the mainline to make the headers user
>> space clean?
> 
> Same as above: I consider the kernel headers as reference. Problems in 
> the application should be fixed there. I do remember running into 
> applications that used kernel space data types. In those cases I usually 
> make the app use the corresponding POSIX types.

That sounds fine (I assume you're submitting patches to the app maintainers).

> Eventually it seems to be a matter of taste where to make the fix.

There are a few cases where userspace needs stuff that's only in kernel
headers, but the kernel headers are still screwed up, and don't work from
userspace.  e.g. here's one patch that should probably go in the kernel tree:

http://kegel.com/crosstool/crosstool-0.28-rc34/patches/linux-2.6.7/kaz-types.patch

I need that to build glibc on sh4.

> The dedicated user api/abi headers that are in the works are definately 
> the best solution.

Whatever the Linux kernel guys do is fine by me, as long as they take
the problem seriously.
- 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