LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-14-2007, 07:59 AM   #1
srinivas_mn
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Rep: Reputation: 0
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,

Last edited by srinivas_mn; 11-14-2007 at 08:03 AM. Reason: highlighting
 
Old 11-14-2007, 04:41 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
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)
 
Old 11-14-2007, 04:42 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
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.
 
Old 11-14-2007, 06:57 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by srinivas_mn View Post
My program hook.c includes the header 'sys/syscall.h'.
Why? This is a userspace header. From kernelspace, just #include <asm/unistd.h>. The only thing you donít get is the alias syscall numbers (e.g., SYS_open in addition to __NR_open). Since you are not in userspace, just use the __NR_* version.
 
Old 11-16-2007, 11:38 PM   #5
srinivas_mn
LQ Newbie
 
Registered: Dec 2005
Posts: 4

Original Poster
Rep: Reputation: 0
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

Last edited by srinivas_mn; 11-16-2007 at 11:41 PM.
 
Old 11-17-2007, 04:41 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
The question is what do you want from the syscalls. You can't run simple open() or so.
 
Old 11-17-2007, 05:08 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by srinivas_mn View Post
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>
Youíre not making any sense. First, what do you want to get from the included file?

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);
Then, you have to include the relevant file that declares them. On 2.6 kernels, this is linux/syscalls.h. But as Mara stated before, you canít just use syscalls from the kernel as if you were in userspace. For a better explanation of the limitations and methods for doing this, read here.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RT install error - gd.h no such file or directory Moonman Linux - Software 2 10-11-2007 08:43 PM
Need help to make all file- and directory names linux conform. madking75 Linux - Desktop 2 11-30-2006 11:48 AM
How to make RSYNC skip a directory due to error message ArchW Linux - Networking 5 07-13-2006 11:26 AM
make: *** ld: No such file or directory. Stop. satimis Linux From Scratch 3 07-26-2005 03:15 AM
make error with kdenetwork-3.0.5a: no such file or directory olisr72 Linux - Software 1 07-28-2003 05:15 PM


All times are GMT -5. The time now is 04:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration