Messages in this thread |  | | Date | Mon, 16 Oct 2000 15:57:32 +0100 (BST) | From | Tigran Aivazian <> | Subject | Re: hello world module no longer compiles?! |
| |
On Tue, 17 Oct 2000, Keith Owens wrote:
> On Mon, 16 Oct 2000 15:29:53 +0100 (BST), > Tigran Aivazian <tigran@veritas.com> wrote: > >static void __exit test_exit(void) > >{ > > return; > >} > > > >module_init(test_init); > >module_exit(test_exit); > ># kgcc -Wall -O2 -g -c -o hello.o hello.c > >hello.c:13: parse error before `test_exit' > > Add -v -E -dM to kgcc to see where it is reading its headers from and > to see what the macros are defined to. __exit should be defined to a > noop in a module.
Ok,
# kgcc -v -E -dM -Wall -O2 -g -c -o hello.o hello.c Reading specs from /usr/lib/gcc-lib/i386-glibc21-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) /usr/lib/gcc-lib/i386-glibc21-linux/egcs-2.91.66/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -D__OPTIMIZE__ -g -Wall -dM -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ hello.c -o hello.o GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) (i386 Linux/ELF) #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/i386-glibc21-linux/include /usr/lib/gcc-lib/i386-glibc21-linux/egcs-2.91.66/include /usr/include End of search list. # gcc -v -E -dM -Wall -O2 -g -c -o hello.o hello.c Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000724 (experimental) /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__OPTIMIZE__ -g -Wall -dM -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ hello.c -o hello.o GNU CPP version 2.96 20000724 (experimental) (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/2.96/include /usr/include End of search list.
as you see, gcc tries /usr/lib/gcc-lib/i386-redhat-linux/2.96/include but kgcc tries /usr/i386-glibc21-linux/include which contains a linux subdirectory full of absolutely wrong stuff (i.e. presumably the old 2.2.x kernel headers!). Therefore, simply adding -nosdtinc and an explicit -I should fix the problem, let's try:
# kgcc -nostdinc -I/usr/src/linux/include -Wall -O2 -g -c -o hello.o hello.c /tmp/ccyGrYVt.s: Assembler messages: /tmp/ccyGrYVt.s:69: Warning: Ignoring changed section attributes for .modinfo # insmod hello.o # lsmod Module Size Used by hello 192 0 (unused) vmnet 18016 3 vmmon 19236 0 (unused)
Yes, it works. Thank you.
Tigran
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |