mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* compilation problem of modules
@ 2005-03-02 14:59 sounak chakraborty
  2005-03-02 16:37 ` Randy.Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: sounak chakraborty @ 2005-03-02 14:59 UTC (permalink / raw)
  To: linux-kernel


the code of the module that i written is as follows:
#define MODULE
#include <linux/module.h>
#include <linux/proc_fs.h>
#define MODULE_NAME "manti"
struct manti
{
      char mm[20];
 };
static struct proc_dir_entry *example_dir;
struct manti m1;
int init_module(void)
{
  example_dir=proc_mkdir(MODULE_NAME,NULL);
 if(example_dir==NULL)
  {
     printk("<1> error in creation of proc file\n");
    }
  else
   printk("<1>success in creation of proc dir\n");
  }
void cleanup_module(void)
{
   remove_proc_entry(MODULE_NAME,NULL);
  printk("<1>proc entry removed\n");
 }

here iam just making one directory in the proc file
named manti
i am trying to  compile it like
gcc -c proc.c 
where the kernel version is 2.4.20-8

but i am getting following errors 

In file included from proc.c:5:
/usr/include/linux/proc_fs.h:47: parse error before
"off_t"
/usr/include/linux/proc_fs.h:51: parse error before
"off_t"
/usr/include/linux/proc_fs.h:57: parse error before
"mode_t"
/usr/include/linux/proc_fs.h:59: parse error before
"uid"
/usr/include/linux/proc_fs.h:60: parse error before
"gid"
/usr/include/linux/proc_fs.h:70: parse error before
"count"
/usr/include/linux/proc_fs.h:72: parse error before
"rdev"
/usr/include/linux/proc_fs.h:176: parse error before
"mode_t"
/usr/include/linux/proc_fs.h: In function
`proc_net_create':
/usr/include/linux/proc_fs.h:177: `NULL' undeclared
(first use in this function)
/usr/include/linux/proc_fs.h:177: (Each undeclared
identifier is reported only once
/usr/include/linux/proc_fs.h:177: for each function it
appears in.)
/usr/include/linux/proc_fs.h: At top level:
/usr/include/linux/proc_fs.h:181: parse error before
"mode_t"
/usr/include/linux/proc_fs.h: In function
`create_proc_entry':
/usr/include/linux/proc_fs.h:181: `NULL' undeclared
(first use in this function)
/usr/include/linux/proc_fs.h: In function
`proc_symlink':
/usr/include/linux/proc_fs.h:185: `NULL' undeclared
(first use in this function)
/usr/include/linux/proc_fs.h: At top level:
/usr/include/linux/proc_fs.h:186: parse error before
"mode_t"
/usr/include/linux/proc_fs.h: In function
`proc_mknod':
/usr/include/linux/proc_fs.h:187: `NULL' undeclared
(first use in this function)
/usr/include/linux/proc_fs.h: In function
`proc_mkdir':
/usr/include/linux/proc_fs.h:189: `NULL' undeclared
(first use in this function)
/usr/include/linux/proc_fs.h: At top level:
/usr/include/linux/proc_fs.h:192: parse error before
"mode_t"
/usr/include/linux/proc_fs.h:193: parse error before
"off_t"
/usr/include/linux/proc_fs.h:193:
`create_proc_read_entry' declared as function
returning a function
/usr/include/linux/proc_fs.h:196: parse error before
"mode_t"
/usr/include/linux/proc_fs.h: In function
`create_proc_info_entry':
/usr/include/linux/proc_fs.h:197: `NULL' undeclared
(first use in this function)
/usr/include/linux/proc_fs.h: At top level:
/usr/include/linux/proc_fs.h:203: `NULL' used prior to
declaration
proc.c: In function `init_module':
proc.c:16: `NULL' has an incomplete type
proc.c:17: invalid operands to binary ==
proc.c: In function `cleanup_module':
proc.c:26: `NULL' has an incomplete type



how to solve it 
plz help me
is my compilation method is wrong or something else 

thanks 
sounak

________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: compilation problem of modules
  2005-03-02 14:59 compilation problem of modules sounak chakraborty
@ 2005-03-02 16:37 ` Randy.Dunlap
  2005-03-02 16:58   ` Tommy Reynolds
  0 siblings, 1 reply; 3+ messages in thread
From: Randy.Dunlap @ 2005-03-02 16:37 UTC (permalink / raw)
  To: sounak chakraborty; +Cc: linux-kernel

sounak chakraborty wrote:
> the code of the module that i written is as follows:
> #define MODULE
> #include <linux/module.h>
> #include <linux/proc_fs.h>
> #define MODULE_NAME "manti"
> struct manti
> {
>       char mm[20];
>  };
> static struct proc_dir_entry *example_dir;
> struct manti m1;
> int init_module(void)
> {
>   example_dir=proc_mkdir(MODULE_NAME,NULL);
>  if(example_dir==NULL)
>   {
>      printk("<1> error in creation of proc file\n");
>     }
>   else
>    printk("<1>success in creation of proc dir\n");
>   }
> void cleanup_module(void)
> {
>    remove_proc_entry(MODULE_NAME,NULL);
>   printk("<1>proc entry removed\n");
>  }
> 
> here iam just making one directory in the proc file
> named manti
> i am trying to  compile it like
> gcc -c proc.c 
> where the kernel version is 2.4.20-8
> 
> but i am getting following errors 
> 
> In file included from proc.c:5:
> /usr/include/linux/proc_fs.h:47: parse error before
> "off_t"
> /usr/include/linux/proc_fs.h:51: parse error before
> "off_t"
> /usr/include/linux/proc_fs.h:57: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h:59: parse error before
> "uid"
> /usr/include/linux/proc_fs.h:60: parse error before
> "gid"
> /usr/include/linux/proc_fs.h:70: parse error before
> "count"
> /usr/include/linux/proc_fs.h:72: parse error before
> "rdev"
> /usr/include/linux/proc_fs.h:176: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `proc_net_create':
> /usr/include/linux/proc_fs.h:177: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h:177: (Each undeclared
> identifier is reported only once
> /usr/include/linux/proc_fs.h:177: for each function it
> appears in.)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:181: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `create_proc_entry':
> /usr/include/linux/proc_fs.h:181: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: In function
> `proc_symlink':
> /usr/include/linux/proc_fs.h:185: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:186: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `proc_mknod':
> /usr/include/linux/proc_fs.h:187: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: In function
> `proc_mkdir':
> /usr/include/linux/proc_fs.h:189: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:192: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h:193: parse error before
> "off_t"
> /usr/include/linux/proc_fs.h:193:
> `create_proc_read_entry' declared as function
> returning a function
> /usr/include/linux/proc_fs.h:196: parse error before
> "mode_t"
> /usr/include/linux/proc_fs.h: In function
> `create_proc_info_entry':
> /usr/include/linux/proc_fs.h:197: `NULL' undeclared
> (first use in this function)
> /usr/include/linux/proc_fs.h: At top level:
> /usr/include/linux/proc_fs.h:203: `NULL' used prior to
> declaration
> proc.c: In function `init_module':
> proc.c:16: `NULL' has an incomplete type
> proc.c:17: invalid operands to binary ==
> proc.c: In function `cleanup_module':
> proc.c:26: `NULL' has an incomplete type
> 
> 
> 
> how to solve it 
> plz help me
> is my compilation method is wrong or something else 

compile/build is wrong.
a minimum 2.4 kernel build needs at least:

gcc -c -D__KERNEL__ -DMODULE -O2 -nostdinc proc.c

and probably a few other flags/options.

-- 
~Randy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: compilation problem of modules
  2005-03-02 16:37 ` Randy.Dunlap
@ 2005-03-02 16:58   ` Tommy Reynolds
  0 siblings, 0 replies; 3+ messages in thread
From: Tommy Reynolds @ 2005-03-02 16:58 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

Uttered "Randy.Dunlap" <rddunlap@osdl.org>, spake thus:

> compile/build is wrong.
> a minimum 2.4 kernel build needs at least:
> 
> gcc -c -D__KERNEL__ -DMODULE -O2 -nostdinc proc.c

Don't forget the kernel headers!

# gcc -c -D__KERNEL__ -DMODULE -O2 -I/usr/src/linux/include -nostdinc proc.c

and, if you have module symbol versioning turned on, you'll need still more!

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-02 17:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-02 14:59 compilation problem of modules sounak chakraborty
2005-03-02 16:37 ` Randy.Dunlap
2005-03-02 16:58   ` Tommy Reynolds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome