Bug 73234 - compile erro from module.h
Summary: compile erro from module.h
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 7.3
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-09-01 13:54 UTC by Ali Reza Bahmani
Modified: 2007-04-18 16:46 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-06-09 18:08:07 UTC
Embargoed:


Attachments (Terms of Use)

Description Ali Reza Bahmani 2002-09-01 13:54:32 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.0.0-10; Linux)

Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.i write a module . 
2.
#include <linux/module.h>  /* Needed by all modules */
#include <linux/kernel.h>  /* Needed for KERN_ALERT */


int init_module(void)
{
           printk("<1>Hello world 1.\n");

              /* A non 0 return means init_module failed; module can't be loaded. */
              return 0;
}


void cleanup_module(void)
{
          printk(KERN_ALERT "Goodbye world 1.\n");
}
3. and write Makefile 
4. 
  # Makefile for a basic kernel module

CC=gcc
CFLAGS   := -c -0 -W -Wall -Wstrict-prototypes -Wmissing-prototypes
MODFLAGS := -DMODULE -D__KERNEL__


hello-1.o: hello.c
        ${CC} ${MODCFLAGS} hello.c
5. after run make command this erros occurd : 
6. 
gcc  hello.c
In file included from hello.c:1:
/usr/include/linux/module.h:60: parse error before `atomic_t'
/usr/include/linux/module.h:60: warning: no semicolon at end of struct or union
/usr/include/linux/module.h:60: warning: no semicolon at end of struct or union
/usr/include/linux/module.h:62: parse error before `}'
/usr/include/linux/module.h:62: warning: data definition has no type or storage class
/usr/include/linux/module.h:91: parse error before `}'
hello.c: In function `cleanup_module':
hello.c:16: `KERN_ALERT' undeclared (first use in this function)
hello.c:16: (Each undeclared identifier is reported only once
hello.c:16: for each function it appears in.)
hello.c:16: parse error before string constant
make: *** [hello-1.o] Error 1


7. i tested it from another computer but both of result are equal  

please help me 
My mail is ar_Bahmani 

Additional info:

Comment 1 Arjan van de Ven 2002-09-01 13:57:14 UTC
Your makefile has a bug that causes it to compile using glibc headers and not
kernel headers.
You need to add -I/lib/modules/`uname -r'/build/include

to the CFLAGS


Note You need to log in before you can comment on or make changes to this bug.