yann | 1 Feb 2011 11:13
Favicon

Question about include path

Hi,

I build gcc (4.5.2) from scratch, and i have a question with include 
path.

when i want to include "limits.h" (the good one is at 
/LFS2011/include/limits.h), gcc uses 
/LFS2011/bin/../lib/gcc/i686-pc-linux-gnu/4.5.1/include-fixed/limits.h

When i add "-I/LFS2011/include" it does not look for  
/LFS2011/include/limits.h (bad ?) but when I add "-I/tmp", it looks for 
/tmp/limits.h (good)

What is wrong, where can i look into gcc source code to debug it ?

Thank you.

Yann Le Doaré

***************************************

my test.c :

#include "limits.h"

int main()
{
}

*******************************************************************
strace -f -e open -o logs gcc -I/LFS2011/include test.c
bash-3.2# grep limits.h logs
5469  open("limits.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or 
directory)
5469  
open("/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include/limits.h", 
O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
5469  
open("/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed/limits.h", 
O_RDONLY|O_NOCTTY) = 4

*****************************************************

strace -f -e open -o logs gcc -I/tmp test.c

grep limits.h logs
5460  open("limits.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or 
directory)
5460  open("/tmp/limits.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such 
file or directory)
5460  
open("/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include/limits.h", 
O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
5460  
open("/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed/limits.h", 
O_RDONLY|O_NOCTTY) = 4

*******************************************************

The options to build gcc (from LFS script) :

*********************************************
    --prefix=/LFS2011 \
    --with-local-prefix=/LFS2011 --enable-clocale=gnu \
    --enable-shared --enable-threads=posix \
    --enable-__cxa_atexit --enable-languages=c,c++ \
    --disable-libstdcxx-pch --disable-multilib \
    --disable-bootstrap --disable-libgomp \
    --with-gmp=/LFS2011 --with-mpfr=/LFS2011 --with-mpc=/LFS2011 \
    --without-ppl --without-cloog --target=$LFS_TGT --host=$LFS_TGT 
--build=$LFS_TGT


Gmane