problem with compiling a simple module
hello everybod, i wanted to compile a simple module on my suse box 9.0 kernel 2.4.21-99, but it did nott work.
I don't know what's the problem(quite a newby), I looked in several forum for similar threads but nobody could answer my question.
this is the module example:
#define MODULE
#include <linux/module.h>
int init_module(void) { printk("<1>Hallo, Welt\n"); return 0; }
void cleanup_module(void) { printk("<1>Ade, du grausame Welt\n"); }
and when I compile it with
gcc -c hello.c i get the following:
Z626:/home/igor # gcc -c hello.c
In file included from /usr/include/linux/sched.h:12,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/jiffies.h:16: error: parse error before "jiffies_64"
/usr/include/linux/jiffies.h:20: error: parse error before
"get_jiffies_64"
In file included from /usr/include/linux/sched.h:20,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/asm/mmu.h:13: error: field `sem' has incomplete type
In file included from /usr/include/linux/signal.h:4,
from /usr/include/linux/sched.h:24,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/list.h:563:2: Warnung: #warning "don't include kernel
headers in userspace"
In file included from /usr/include/asm/siginfo.h:4,
from /usr/include/linux/signal.h:7,
from /usr/include/linux/sched.h:24,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/asm-generic/siginfo.h:49: error: size of array `_pad' is too
large
In file included from /usr/include/linux/sched.h:26,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/fs_struct.h:9: error: parse error before "rwlock_t"
/usr/include/linux/fs_struct.h:13: error: parse error before '}' token
In file included from /usr/include/linux/sched.h:28,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/completion.h:15: error: parse error before
"wait_queue_head_t"
/usr/include/linux/completion.h: In function `init_completion':
/usr/include/linux/completion.h:26: error: dereferencing pointer to
incomplete type
/usr/include/linux/completion.h:27: error: dereferencing pointer to
incomplete type
In file included from /usr/include/linux/sched.h:29,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/pid.h: At top level:
/usr/include/linux/pid.h:18: error: field `task_list' has incomplete type
/usr/include/linux/pid.h:19: error: field `hash_chain' has incomplete type
/usr/include/linux/pid.h:24: error: field `pid_chain' has incomplete type
In file included from /usr/include/linux/sched.h:30,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/percpu.h: In function `__alloc_percpu':
/usr/include/linux/percpu.h:46: error: `GFP_KERNEL' undeclared (first use
in this function)
/usr/include/linux/percpu.h:46: error: (Each undeclared identifier is
reported only once
/usr/include/linux/percpu.h:46: error: for each function it appears in.)
In file included from /usr/include/linux/sched.h:101,
from /usr/include/linux/module.h:9,
from hello.c:3:
/usr/include/linux/timer.h: At top level:
/usr/include/linux/timer.h:10: error: field `entry' has incomplete typ
Please help me!!!
i would apreciate every kind of help
thank you
|