Bug 10532 - include-path broken for cross-gccs (PREFIX_INCLUDE_DIR)
Summary: include-path broken for cross-gccs (PREFIX_INCLUDE_DIR)
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
: 10533 (view as bug list)
Depends on:
Reported: 2003-04-29 01:36 UTC by corsepiu
Modified: 2003-09-28 21:18 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2003-05-27 13:05:50

gcc-3.2.2-prefix-include-dir.diff (208 bytes, patch)
2003-05-21 15:17 UTC, corsepiu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description corsepiu 2003-04-29 01:36:01 UTC
Any cross-gcc has $prefix/include before 
$prefix/<target>/include and $prefix/lib/gcc-lib/<target>/<version>/include in its include-path.

This is not correct, because $prefix/include for cross-gccs contains host-headers, not target-headers, like it does for native gccs and therefore bogusly pulls-in host headers.

gcc-3.2.x, gcc-3.3, gcc-3.4


Build a cross-gcc and examine the include-path
touch tmp.c
i386-rtems-gcc -v -o tmp.o -c tmp.c

gcc version 3.2.2 (OAR Corporation gcc-3.2.2-20030425/newlib-1.11.0-20030416a-0_rc_10)
 /opt/rtems/lib/gcc-lib/i386-rtems/3.2.2/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102
-D__rtems__ -D__ELF__ -D__i386__ -D__USE_INIT_FINI__ -D__rtems__ -D__ELF__ -D__i386__ -D__USE_INIT_FINI__ -Asystem=rtems -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ tmp.c -quiet -dumpbase tmp.c -version -o /tmp/cc66lQPD.s
GNU CPP version 3.2.2 (OAR Corporation gcc-3.2.2-20030425/newlib-1.11.0-20030416a-0_rc_10) (cpplib) (i386 bare ELF target)
GNU C version 3.2.2 (OAR Corporation gcc-3.2.2-20030425/newlib-1.11.0-20030416a-0_rc_10) (i386-rtems)
        compiled by GNU C version 3.2.2 20030313 (Red Hat Linux 3.2.2-10).
ignoring nonexistent directory "/opt/rtems/i386-rtems/sys-include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
Comment 1 corsepiu 2003-04-29 01:36:01 UTC
The cause of this seems to be PREFIX_INCLUDE_DIR in gcc/configure.in. 
The patch in the attachment works around this issue by #undef'ing PREFIX_INCLUDE_DIR in cppdefaults.h for cross-compilation.
Comment 2 Dara Hazeghi 2003-05-26 22:55:48 UTC

I can confirm that this problem still occurs on gcc 3.3 branch. On mainline, the code in question 
seems to have changed quite a bit. Could you send your patch to gcc-patches, with a note that it 
fixes this PR? Thanks,


P.S. The category of this report should be changed to preprocessor IMHO.
Comment 3 Andrew Pinski 2003-05-27 13:05:50 UTC
See Dara's comment 2.
Comment 4 Daniel Jacobowitz 2003-07-01 21:49:47 UTC
Ralf wrote on gcc-patches:
> Well, all I can say is: 
> * I had been able to reproduce my problem with gcc-trunk as of last
> week. (The date 2003-02-13 makes me wonder.)

This doesn't make sense.  No cross compiler on the trunk should be
including $prefix/include, and shouldn't have since I checked in that
patch, in February 2003.  Please investigate why that happened.
Comment 5 Andrew Pinski 2003-09-28 21:18:09 UTC
No feedback in 3 months (T-3 days).