Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 73234 - compile erro from module.h
compile erro from module.h
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-09-01 09:54 EDT by Ali Reza Bahmani
Modified: 2007-04-18 12:46 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-06-09 14:08:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ali Reza Bahmani 2002-09-01 09:54:32 EDT
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:

Steps to Reproduce:
1.i write a module . 
#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 
  # Makefile for a basic kernel module

CFLAGS   := -c -0 -W -Wall -Wstrict-prototypes -Wmissing-prototypes

hello-1.o: hello.c
        ${CC} ${MODCFLAGS} hello.c
5. after run make command this erros occurd : 
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@yahoo.com 

Additional info:
Comment 1 Arjan van de Ven 2002-09-01 09:57:14 EDT
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.