Re: Some general LINUX questions on compiling and header files

Wakko Warner (wakko@animx.eu.org)
Thu, 9 Sep 1999 12:31:21 -0400


> I've been looking around and haven't been able to find a few things on Linux
> that I was expecting to find.
>
> 1. Is there a standard preprocessor token you can check for to know that the
> compilation is on Linux? I'm looking for something like the __sun token that
> is predefined by the compiler, so I can put conditional code in a module I
> share amoungst multiple operating systems.

tried looking at what `uname` returns?
[wakko@ani:/] uname
Linux
[wakko@ani:/]

> 2. Where is the <stddef.h> header file required by ANSI C? I looked in
> /usr/include and didn't see it.

[wakko@ani:/] locate stddef
/usr/include/linux/stddef.h
/usr/lib/gcc-lib/i486-linux/2.7.2.3/include/stddef.h
/usr/lib/gcc-lib/i486-linuxchecker/2.7.2.3/include/stddef.h
[wakko@ani:/]

> 4. When compiling a kernel module, what special flags are required? I would
> expect to have to put in '-r -nostdlib' at the very least.

I don't believe you compile them like you do a program. SCIIW, but modules
should be compiled with -c and not linked. Try ldd'ing one of them:

[wakko@ani:/] ldd /lib/modules/2.2.10/block/floppy.o
not a dynamic executable
[wakko@ani:/]

Sorry I can't help you on #3

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/