Skip to contentSkip to conversation

sparse refuses to work due to stdarg.h

DISCUSSION Pavel Machek 4 participants 5 messages Jan 16, 2005 – Jan 17, 2005

lore
Share & tools
lore
#0 lore raw

Hi!

I'm probably doing something wrong, but... how do I force it to work? I'm pretty sure it worked before, I'm not sure what changed in my config.

pavel@amd:/usr/src/linux$ make C=2
  CHK     include/linux/version.h
  CHECK   scripts/mod/empty.c
make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
  CHECK   init/main.c
include/linux/kernel.h:10:11: error: unable to open 'stdarg.h'

Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#1 lore raw
Quoted 5 lines · Pavel Machek

Hi!

I'm probably doing something wrong, but... how do I force it to work? I'm pretty sure it worked before, I'm not sure what changed in my config.

kbuild was changed to reliably pick up the stdarg.h for the gcc used. Two issues has popped up:
1) sparse did not support -isystem dir
- fixed a few days ago, and fix is at sparse.bkbits.net
2) misconfigured gcc's that report a wrong directory when using gcc -print-file-name=include
The directory given must include stdarg.h - otherwise gcc config is broken.

You are hit by 1)

Sam

#2 lore raw

Hi!

Quoted 8 lines
Quoted 3 lines

I'm probably doing something wrong, but... how do I force it to work? I'm pretty sure it worked before, I'm not sure what changed in my config.

kbuild was changed to reliably pick up the stdarg.h for the gcc used. Two issues has popped up:
1) sparse did not support -isystem dir
- fixed a few days ago, and fix is at sparse.bkbits.net

Thanks, I installed -01-17 version.

Quoted 4 lines

2) misconfigured gcc's that report a wrong directory when using gcc -print-file-name=include
The directory given must include stdarg.h - otherwise gcc config is broken.

That seems to be ok here:

pavel@amd:~$ gcc -print-file-name=include
/usr/lib/gcc-lib/i486-linux/3.3.5/include
pavel@amd:~$ gcc --version
gcc (GCC) 3.3.5 (Debian 1:3.3.5-5)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
pavel@amd:~$ ls /usr/lib/gcc-lib/i486-linux/3.3.5/
SYSCALLS.c.X  cc1plus       crtbegin.o    crtbeginT.o   crtendS.o
libgcc.a      libgcc_s.so   libstdc++.so  specs
cc1           collect2      crtbeginS.o   crtend.o      include
libgcc_eh.a   libstdc++.a   libsupc++.a
pavel@amd:~$ ls /usr/lib/gcc-lib/i486-linux/3.3.5/include/st
stdarg.h   stdbool.h  stddef.h
pavel@amd:~$ ls /usr/lib/gcc-lib/i486-linux/3.3.5/include/stdarg.h
/usr/lib/gcc-lib/i486-linux/3.3.5/include/stdarg.h
pavel@amd:~$

but now I'm getting:

pavel@amd:/usr/src/linux-cvs$ make C=2
  CHK     include/linux/version.h
  CHECK   scripts/mod/empty.c
make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
  CHECK   init/main.c
/usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/posix_types.h:29:35: warning: no newline at end of file
/usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/posix_types.h:13:11: error: unable to open 'features.h'
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
pavel@amd:/usr/src/linux-cvs$

Any ideas?
Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#3 lore raw
Quoted 10 lines · Pavel Machek
pavel@amd:/usr/src/linux-cvs$ make C=2
  CHK     include/linux/version.h
  CHECK   scripts/mod/empty.c
make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
  CHECK   init/main.c
/usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/posix_types.h:29:35: warning: no newline at end of file
/usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/posix_types.h:13:11: error: unable to open 'features.h'
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
pavel@amd:/usr/src/linux-cvs$

You seems to have a symlink? to /usr/include/asm in your 3.3.5/include directory.
But real issue is search order of include paths in sparse. sparse searches standard system dirs before dir's specified with -I ... This in contradiction to 'info gcc - see description for -I'.

Sam

#4 lore raw

Sam> You seems to have a symlink? to /usr/include/asm in your Sam> 3.3.5/include directory.

No, with debian gcc, /usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/ is a real directory that includes nothing but posix_types.h.

Sam> But real issue is search order of include paths in sparse. Sam> sparse searches standard system dirs before dir's specified Sam> with -I ... This in contradiction to 'info gcc - see Sam> description for -I'.

Looks like you're right. On Debian, "make C=1 V=1" ends up with:

      sparse -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -nostdinc -isystem /usr/lib/gcc-lib/i486-linux/3.3.5/include -D__i386__ -Wp,-MD,init/.main.o.d -nostdinc -isystem /usr/lib/gcc-lib/i486-linux/3.3.5/include -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -pipe -msoft-float -mpreferred-stack-boundary=2  -march=i686  -mregparm=3 -Iinclude/asm-i386/mach-default     -DKBUILD_BASENAME=main -DKBUILD_MODNAME=main init/main.c ;
    /usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/posix_types.h:29:35: warning: no newline at end of file
    /usr/lib/gcc-lib/i486-linux/3.3.5/include/asm/posix_types.h:13:11: error: unable to open 'features.h'

so sparse is picking up the posix_types.h from the -isystem path instead of the -I path as it should.

- Roland