# due to systm.h  problem compile error



## k0der (May 13, 2009)

hi ,
 i was trying to compile the file syscall.c available with the freebsd itself in the folder /usr/examples/kld/module (i guess)..
 when i tried to compile the file i got the following error :

```
%gcc -o syscall syscall.c
In file included from syscall.c:35:
/usr/include/sys/systm.h:278: error: syntax error before "splbio"
/usr/include/sys/systm.h:279: error: syntax error before "splcam"
/usr/include/sys/systm.h:280: error: syntax error before "splclock"
/usr/include/sys/systm.h:281: error: syntax error before "splhigh"
/usr/include/sys/systm.h:282: error: syntax error before "splimp"
/usr/include/sys/systm.h:283: error: syntax error before "splnet"
/usr/include/sys/systm.h:284: error: syntax error before "splsoftcam"
/usr/include/sys/systm.h:285: error: syntax error before "splsoftclock"
/usr/include/sys/systm.h:286: error: syntax error before "splsofttty"
/usr/include/sys/systm.h:287: error: syntax error before "splsoftvm"
/usr/include/sys/systm.h:288: error: syntax error before "splsofttq"
/usr/include/sys/systm.h:289: error: syntax error before "splstatclock"
/usr/include/sys/systm.h:290: error: syntax error before "spltty"
/usr/include/sys/systm.h:291: error: syntax error before "splvm"
/usr/include/sys/systm.h:292: error: syntax error before "ipl"
In file included from syscall.c:35:
/usr/include/sys/systm.h:38:1: unterminated #ifndef
%
```
i tried even to comment out the above lines giving error and i changed the permissions too using root account but still i am not able to edit the *systm.h *file even though it shows that after changing it has all permission for root.

Please help e in removing this error.
thanks in advance..


----------



## DutchDaemon (May 13, 2009)

You mean:

```
[root@box /usr/src/share/examples/kld/syscall/module]# ls -al
total 10
drwxr-xr-x  2 root  wheel   512 May 13 16:23 .
drwxr-xr-x  4 root  wheel   512 May  2  2008 ..
-rw-r--r--  1 root  wheel   199 Sep 18  2001 [B]Makefile[/B]
-rw-r--r--  1 root  wheel  2437 Jul 22  2007 syscall.c
```


```
[root@box /usr/src/share/examples/kld/syscall/module]# [B]make[/B]
Warning: Object directory not changed from original /usr/src/share/examples/kld/syscall/module
@ -> /usr/src/sys
machine -> /usr/src/sys/i386/include
cc -O2 -fno-strict-aliasing -pipe  -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc   -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common  -mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -c syscall.c
ld  -d -warn-common -r -d -o syscall.kld syscall.o
:> export_syms
awk -f /sys/conf/kmod_syms.awk syscall.kld  export_syms | xargs -J% objcopy % syscall.kld
ld -Bshareable  -d -warn-common -o syscall.ko syscall.kld
objcopy --strip-debug syscall.ko
```


```
[root@box /usr/src/share/examples/kld/syscall/module]# ls -al
total 18
drwxr-xr-x  2 root  wheel   512 May 13 16:21 .
drwxr-xr-x  4 root  wheel   512 May  2  2008 ..
lrwxr-xr-x  1 root  wheel    12 May 13 16:21 @ -> /usr/src/sys
-rw-r--r--  1 root  wheel   199 Sep 18  2001 Makefile
-rw-r--r--  1 root  wheel     0 May 13 16:21 export_syms
lrwxr-xr-x  1 root  wheel    25 May 13 16:21 machine -> /usr/src/sys/i386/include
-rw-r--r--  1 root  wheel  2437 Jul 22  2007 syscall.c
-rw-r--r--  1 root  wheel  2045 May 13 16:21 syscall.kld
-rwxr-xr-x  1 root  wheel  3456 May 13 16:21 [B]syscall.ko[/B]
-rw-r--r--  1 root  wheel  1952 May 13 16:21 syscall.o
```


----------



## k0der (Jun 14, 2009)

make is not working on my machine though i have that makefile..thats the problem is.any other way to compile and load the module..thanks for help anyways..


----------



## SirDice (Jun 15, 2009)

k0der said:
			
		

> make is not working on my machine though i have that makefile.


Maybe you should fix that? Why doesn't it work?


----------



## k0der (Jun 18, 2009)

i mean to say that its simply not working on make command.I am not well aware about make files.Could you please tell me what may be the problem and guide me to solve them.
i would appreciate your valuable help.
thanks in advance.


----------



## DutchDaemon (Jun 18, 2009)

What do you mean 'make does not work'? What happens?


----------



## k0der (Jul 10, 2009)

when i run the make file already present i get following error


```
% make
"/usr/share/mk/bsd.kmod.mk", line 12: "can't find kernel source tree"
%
```


----------



## joel@ (Jul 10, 2009)

k0der said:
			
		

> make
> "/usr/share/mk/bsd.kmod.mk", line 12: "can't find kernel source tree"
> %


Grab /usr/src from your nearest cvsup server.


----------

