* Question about include path
@ 2011-02-01 10:13 yann
2011-02-01 19:47 ` Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: yann @ 2011-02-01 10:13 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about include path
2011-02-01 10:13 Question about include path yann
@ 2011-02-01 19:47 ` Ian Lance Taylor
2011-02-03 14:31 ` yann
0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2011-02-01 19:47 UTC (permalink / raw)
To: yann; +Cc: gcc-help
<yann@linuxconsole.org> writes:
> 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 ?
The code in question is in the libcpp directory and in gcc/cppdefault.c.
However, this seems like an unlikely scenario. Are you sure that the
directory /LFS2011/include exists? Also, use the -v option to see the
exact search path that gcc will use.
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about include path
2011-02-01 19:47 ` Ian Lance Taylor
@ 2011-02-03 14:31 ` yann
2011-02-03 18:23 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: yann @ 2011-02-03 14:31 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-help
into gcc/incpath.c :
into remove_duplicates :
/LFS2011/include is removed because "it is a non-system directory that
duplicates a system directory"
Then the search order is :
/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include
/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed
/LFS2011/include
/usr/include
the problem is that a "limits.h" is into
/LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed/
The "-I" option should not overwrite search order (and put
/LFS2011/include as first directory) ?
Thanks very much
Yann Le Doaré.
On Tue, 01 Feb 2011 11:47:01 -0800, Ian Lance Taylor <iant@google.com>
wrote:
> <yann@linuxconsole.org> writes:
>
>> 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 ?
>
> The code in question is in the libcpp directory and in gcc/cppdefault.c.
> However, this seems like an unlikely scenario. Are you sure that the
> directory /LFS2011/include exists? Also, use the -v option to see the
> exact search path that gcc will use.
>
> Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about include path
2011-02-03 14:31 ` yann
@ 2011-02-03 18:23 ` Jonathan Wakely
2011-02-04 10:47 ` yann
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2011-02-03 18:23 UTC (permalink / raw)
To: yann; +Cc: Ian Lance Taylor, gcc-help
On 3 February 2011 14:31, <yann@linuxconsole.org> wrote:
> into gcc/incpath.c :
>
> into remove_duplicates :
>
> /LFS2011/include is removed because "it is a non-system directory that
> duplicates a system directory"
>
> Then the search order is :
>
> /LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include
> /LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed
> /LFS2011/include
> /usr/include
>
> the problem is that a "limits.h" is into
> /LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed/
>
> The "-I" option should not overwrite search order (and put
> /LFS2011/include as first directory) ?
No, see the manual entry for -I to see how standard system include
directories are handled:
http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
As documented you can use -isystem if needed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about include path
2011-02-03 18:23 ` Jonathan Wakely
@ 2011-02-04 10:47 ` yann
0 siblings, 0 replies; 5+ messages in thread
From: yann @ 2011-02-04 10:47 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: Ian Lance Taylor, gcc-help
Thank you,
to fix my problem, I just added
#ifndef _LIBC_LIMITS_H_
#include "/LFS2011/include/limits.h"
#endif
on top of /LFS2011/lib/gcc/i586-pc-linux/4.5.2/include-fixed/limits.h
I tried to understand why (GCC) limits.h is into include-fixed, without
success.
I found Ian message here :
http://gcc.gnu.org/ml/gcc/2007-12/msg00095.html but my glibc is not
buildt with "-nostdinc" option.
On Thu, 3 Feb 2011 18:23:29 +0000, Jonathan Wakely
<jwakely.gcc@gmail.com> wrote:
> On 3 February 2011 14:31, <yann@linuxconsole.org> wrote:
>> into gcc/incpath.c  :
>>
>> into remove_duplicates :
>>
>> /LFS2011/include is removed because "it is a non-system directory that
>> duplicates a system directory"
>>
>> Then the search order is :
>>
>> Â /LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include
>> Â /LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed
>> Â /LFS2011/include
>> Â /usr/include
>>
>> the problem is that a "limits.h" is into
>> /LFS2011/bin/../lib/gcc/i586-pc-linux/4.5.2/include-fixed/
>>
>> The "-I" option should not overwrite search order (and put
>> /LFS2011/include as first directory) ?
>
> No, see the manual entry for -I to see how standard system include
> directories are handled:
> http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
>
> As documented you can use -isystem if needed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-04 9:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 10:13 Question about include path yann
2011-02-01 19:47 ` Ian Lance Taylor
2011-02-03 14:31 ` yann
2011-02-03 18:23 ` Jonathan Wakely
2011-02-04 10:47 ` yann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).