hello()
void hello(void) { printf ("Hello\n"); } <-*-*- This is not my real name, I am undercover -*-*-> - - - - - - - - - - - - - - - - - - - - - - - - - - advertisement - - - - - - Limited Time Offer: FREE Products! Pay only shipping and handling. Get FREE Software, CDR's, Cellular Accessories, Videos, DVD's, Music, Injet Refills and much more. Only when you click here now - - > http://www.free-irewards.com/cgi-bin/bmb2 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
hello world module no longer compiles?!
Hi guys, I always test new ideas or learn about things by writing a little module that does what I want to explore. But today I discovered that on a Red Hat 6.9 system (running test10-pre3 with everything correctly upgraded) I can no longer compile a trivial skeleton hello.c unless I use the latest gcc instead of kgcc (which I don't really want to use); any idea why? (my /usr/include/linux of course pointd to the kernel src's /usr/src/linux/include/linux and the same for asm). Maybe kgcc is told to use the headers in some hardcoded _wrong_ location and so can't understand __exit? # cat hello.c #define __KERNEL__ #define MODULE #define __SMP__ #include #include static int __init test_init(void) { return 0; } 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' hello.c:14: warning: return-type defaults to `int' hello.c: In function `test_exit': hello.c:15: warning: `return' with no value, in function returning non-void hello.c: At top level: hello.c:18: warning: type defaults to `int' in declaration of `module_init' hello.c:18: warning: parameter names (without types) in function declaration hello.c:18: warning: data definition has no type or storage class hello.c:19: warning: type defaults to `int' in declaration of `module_exit' hello.c:19: warning: parameter names (without types) in function declaration hello.c:19: warning: data definition has no type or storage class hello.c:9: warning: `test_init' defined but not used # gcc -Wall -O2 -g -c -o hello.o hello.c /tmp/ccSldzhv.s: Assembler messages: /tmp/ccSldzhv.s:54: Warning: Ignoring changed section attributes for .modinfo # l hello.o -rw-r--r--1 root root 4360 Oct 16 15:24 hello.o - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: hello world module no longer compiles?!
On Mon, 16 Oct 2000 15:29:53 +0100 (BST), Tigran Aivazian <[EMAIL PROTECTED]> 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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
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 <[EMAIL PROTECTED]> 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 2724 (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 2724 (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 hello192 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 [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: hello world module no longer compiles?!
In article <[EMAIL PROTECTED]> you wrote: > # kgcc -v -E -dM -Wall -O2 -g -c -o hello.o hello.c The biggest problem with this is that you use the glibc headers (in /usr/include) instead of the kernel headers (in /usr/src/linux/include) kgcc -O2 -I/usr/src/linux/include -D__KERNEL__ -o hello.o hello.c would be a much better command-line. Greetings, Arjan van de Ven - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: hello world module no longer compiles?!
On Mon, 16 Oct 2000, Arjan van de Ven wrote: > In article <[EMAIL PROTECTED]> you wrote: > > > # kgcc -v -E -dM -Wall -O2 -g -c -o hello.o hello.c > > The biggest problem with this is that you use the glibc headers (in > /usr/include) instead of the kernel headers (in /usr/src/linux/include) > > kgcc -O2 -I/usr/src/linux/include -D__KERNEL__ -o hello.o hello.c > > would be a much better command-line. I agree. The main reason, imho, being the fact that we need and that is found in one of those "private" locations so -nostdinc will hide it unnecessarily and although the trivial hello.c would compile, a slightly less trivial one (including mm.h/sched.h) won't. But your commandline should compile anything and pick up correctly. Regards, Tigran - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Hello, your friend recommended openxxx to you
You have been invited to check out this adult site by one of your friends who visited us. our URL is http://www.openxxx.net/ enjoy, OpenXXX TEAM 2001 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/