make error - No such file or directory
Hi,
I am trying to compile a project in SUSE 10 and encountering error on running make. I have installed the kernel source code. My program hook.c includes the header 'sys/syscall.h'. The The Makefile contents are as below: ************* UNAME=2.6.16.46-0.12-smp IFLAGS=-I /lib/modules/$(UNAME)/build/include -I /usr/include obj-m := mako.o mako-objs := hash/bitwisehash.o hash/scmp.o hash/htbl.o hash/cq.o module.o protect.o hook.o syscall_linker.o vsyscall.o gdt.oEXTRA_CFLAGS += -I /lib/modules/$(UNAME)/build/include -I /usr/include all: make -C /lib/modules/$(UNAME)/build M=$(PWD) modules syscall_linker.o: gcc -O2 -Wall -c $(IFLAGS) -o syscall_linker.o syscall_linker.s vsyscall.o: gcc -O2 -Wall -c $(IFLAGS) -o vsyscall.o vsyscall.s clean: make -C /lib/modules/$(UNAME)/build M=$(PWD) clean *********** On running make, it gives the following error messages: ....../home/srinivas/XForce/Dev/linux_26/hook.c:14:25: error: sys/syscall.h: No such file or directory In file included from /home/srinivas/XForce/Dev/linux_26/hook.c:17: /home/srinivas/XForce/Dev/linux_26/fn.h:8: warning: function declaration isn’t a prototype /home/srinivas/XForce/Dev/linux_26/fn.h:9: warning: function declaration isn’t a prototype ........ I verified the file is available in path '/usr/include/sys/syscall.h'. I have included the path in makefile. Please advice what could be wrong Thanks, |
From your makefile it looks that EXTRA_CFLAGS is not passed to the compilation (only IFLAGS is used). You may try something like
IFLAGS += $(EXTRA_CFLAGS) |
As a sidenote...you shouldn't use files in /usr/include for your kernel things. Rather go with the version from that specific kernel version. With newer kernel, there might be changes causing conflicts and strange errors.
|
Quote:
|
Hi, Thank you all for your replies.
I have tried including the header located in the following location: /usr/src/linux-2.6.16.46-0.12/arch/um/include/syscall.h but this did not help either: I am not introducing new system calls, but using the existing system calls. Do I still need to use the <asm/unistd.h> I would like to point, the same code is compiling fine in SUSE 9. Please can you elaborate how this has to be handled on newer kernels (SUSE 10)? Thanks |
The question is what do you want from the syscalls. You can't run simple open() or so.
|
Quote:
For example, suppose that in a userspace program you have #include <sys/syscall.h>. What does this mean? Well, on my system, it looks like this. So what do you get? From the first included file (asm/unistd.h), you get all the system call numbers defined as preprocessor macros (e.g., “#define __NR_write 4”). From the second included file (bits/syscall.h), you get the legacy form of the same things (e.g., “#define SYS_write __NR_write”). But neither sys/syscall.h nor bits/syscall.h is available from kernelspace. So if you want the equivalent of #include <sys/syscall.h> in kernelspace, you’ll have to resign yourself to using asm/unistd.h and NOT using the SYS_foo macro forms. If that’s not what you’re looking for, then you haven’t made yourself clear. The only reason you would include /usr/src/linux/arch/um/include/syscall.h is if you are writing special code for the usermode linux pseudoarch. That is a private header available only to code within the tree. Suppose you want the function prototypes for the kernelside system calls. For example, Code:
asmlinkage ssize_t sys_write(unsigned int fd, const char __user *buf, size_t count); |
All times are GMT -5. The time now is 11:43 PM. |