LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Undefined errno reference while compiling loadable module (https://www.linuxquestions.org/questions/linux-software-2/undefined-errno-reference-while-compiling-loadable-module-433402/)

kesher 04-09-2006 01:56 PM

Undefined errno reference while compiling loadable module
 
I think I'm gonna kill myself. This is so stupid... Of course I've looked for a solution all over the net and beyond. No luck, except for the fact that it could be somehow related to linux/unistd.h. I've modified such file and no luck again.

I make NO USE of errno in my code.


Here is my Makefile:


Quote:

o
Code:

bj-m += deiso.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean



Here is the make output:



Quote:

Code:

make -C /lib/modules/2.6.12-9-386/build M=/home/kesher/proyectos/deiso modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.12-9-386'
CC [M] /home/kesher/proyectos/deiso/deiso.o
Building modules, stage 2.
MODPOST
*** Warning: "errno" [/home/kesher/proyectos/deiso/deiso.ko] undefined!
CC /home/kesher/proyectos/deiso/deiso.mod.o
LD [M] /home/kesher/proyectos/deiso/deiso.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.12-9-386'





And of course insmod refuses to load deiso.ko because of the undefined reference.

Any help appreciated

THANKS

foo_bar_foo 04-09-2006 02:50 PM

try
#include <errno.h>

kesher 04-09-2006 02:53 PM

Quote:

Originally Posted by foo_bar_foo
try
#include <errno.h>

I have included linux/errno.h (but I don't use it), and it doesn't work. I can't include userspace libraries in a module, anyway.

foo_bar_foo 04-10-2006 01:22 AM

yea you are right it should be <linux/errno.h>
please forgive as i bat about more non helpfull things
but the real thing that bothers me is
Code:

Entering directory `/usr/src/linux-headers-2.6.12-9-386'
might be a distribution thing but
the only thing i know with the word headers in it is
userspace Linux-Libc-Headers
/lib/modules/`uname -r` needs to be the actual directory used to compile your currently running kernel
almost always just named linux-x.y.x unless you changed its name for some reason


All times are GMT -5. The time now is 11:44 PM.