This is the mail archive of the
mailing list for the GCC project.
-iwithprefix include versus -isystem `gcc -print-fle-name=include`
- From: Sam Ravnborg <sam at ravnborg dot org>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 28 Dec 2004 23:59:46 +0100
- Subject: -iwithprefix include versus -isystem `gcc -print-fle-name=include`
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
-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.