-iwithprefix include versus -isystem `gcc -print-fle-name=include`
Sam Ravnborg
sam@ravnborg.org
Tue Dec 28 22:58:00 GMT 2004
In the linux kernel the trick: -nostdinc -iwithprefix include
is used to locate the compiler specific file: stdarg.h but excluding all
other standard include files.
Reading 'info gcc' it was not obvious to me how the above actually
give the desired behaviour.
So experimenting a little gave the following result:
1) -nostdinc -iwithprefix include
=> #include <stdarg.h> was OK
2) -nostdinc -iwithprefix `gcc --print-file-name=`
=> Was not OK. Adding -v option revealed that the path printed by
--print-file-name= was not used at all.
Conclusion: Only relative paths are used.
But reading 'info gcc' informed that the better solution would be to
use:
-nostdinc -isystem `gcc --print-file-name=`
And it works.
This is tested with gcc 3.3.4
Are there any troubles using -isystem `gcc --print-file-name=include` for older
gcc's like 2.95?
The reason to shift to gcc's --print-file-name=include mechanish is that
this allows gcc and sparse to share the same definition for where to
look for compiler specific files.
Sam
More information about the Gcc-help
mailing list