[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Include path in module compilation
On Thu, Feb 05, 2004 at 15:04:16 -0500, Pedro Sanchez wrote:
> On Thu, 2004-02-05 at 01:34, Nir Tzachar wrote:
> > > Looking at kernel newbies (and other places as well)
> > > I see that kernel modules are compile with the
> > > -I/path/to/kernel/headers.
> > > Meaning not only that the standard includes (i.e.
> > > /usr/include) are used, but also that they are used
> > > BEFORE the kernel headers.
> > >
> > > Is my common sense wrong ?
> >
> > ur common sense is correct, however ur analisys is not complete.
> > although we get -I/path/to/kernel/headers on the command line, we also use
> > -nostdinc . that solves ur problems.
>
> Directories named by -I are searched before the
> standard system include directories. Therefore a flag
> like -I/path/to/kernel/headers shall suffice, isn't it?
>
> Anyway, I tried adding -nostdinc but it breaks the
> compilation of my kernel modules:
>
> /usr/src/linux/include/linux/kernel.h:10:
> stdarg.h: No such file or directory
>
> stdarg.h is a compilation header (not part of the kernel tree)
> and -nostdinc tells the compiler not to look for the standard
> include locations so it can't find it.
>
> So either I use -I/path/to/stdarg.h or not use -nostdinc. Any
> other options?
Ask kernel makefile for proper flags. It will give them out, if you ask
it kindly:
make script 'SCRIPT=echo $(CFLAGS)'
or something like that should do the trick. I am not sure about the
quoting right now -- the makefile simply contains rule:
script:
$(SCRIPT)
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/