Problems compiling kernel modules

From: Lei Yang (leiyang_at_nec-labs.com)
Date: 08/21/04

  • Next message: James Bottomley: "Re: 2.6.8.1-mm3"
    Date:	Sat, 21 Aug 2004 15:24:12 -0400
    To: Kernel Newbies Mailing List <kernelnewbies@nl.linux.org>, linux-kernel <linux-kernel@vger.kernel.org>
    
    

    Hi all,

    I was trying to compile a kernel module with kbuild. The module 'test.c'
    include a header file 'fred.h' and there is a "#include <stdio.h>" in
    'fred.h'.

    Makefile looks like:

    ------------------------------------------------------------------------
    ifneq ($(KERNELRELEASE),)
    obj-m := test.o

    else
    KDIR := /usr/src/linux
    PWD := $(shell pwd)

    default:
            $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
            

    clean:
            rm -f *.o *.ko *.mod.c *.mod.o \
            .test.o.cmd .test.ko.cmd .test.mod.o.cmd
            rm -rf .tmp_versions
    endif

    -------------------------------------------------------------------------
    But upon compiling, there would be errors like this:
    In file included from /home/lei/test.c:49:
    /home/lei/fred.h:4:19: stdio.h: No such file or directory

    and a lot of undeclared names follow which I assume is from stdio.h.

    Could anyone point out what's wrong here?

    TIA!

    Lei
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: James Bottomley: "Re: 2.6.8.1-mm3"

    Relevant Pages

    • Re: [PATCH 504] m68k: smp_lock.h: Avoid recursive include
      ... Not only is that include not recursive, but it immediately breaks any SMP ... compile because that header file _needs_ the definition of "task_struct". ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Problems compiling kernel modules
      ... >>I was trying to compile a kernel module with kbuild. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: managing header files
      ... hundred by commenting out some external declarations, ... complaints) but the complaints about redundant declarations and the complaints ... to simplify the problem I decided to just try to compile ... approach of, in effect, finding one header file that all the .c files ...
      (comp.lang.c.moderated)
    • Re: Converting .lib to .dll
      ... Adding the header file to the project does nothing. ... a DLL file. ... EXPORT_SETTING int VP_DoWhatever(int parameter1, int parameter2) ... And when you compile this, ...
      (microsoft.public.dotnet.framework.compactframework)
    • Re: Parse errors
      ... Your code, shown in the previous message, will not compile with either ... NULL (which clearly indicates that it is a pointer). ... in it appropriate to a header file! ... you need prototypes for all of the functions defined in this ...
      (comp.os.linux.development.apps)