http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48910
           Summary: Current working directory in system include search
                    path
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: adam_...@hotmail.com


Current working directory (aka. ".") is included in the system include search
path chain, which causes compilation of gcc (and other program, such as
binutils) to fail due to wrong header was matched.

The command line parameter for compiling in the gcc directory
("host-xx-xx.../gcc") have a list of include search paths, including "-I.",
"-I../libdecnumber", and others. Because "." was inserted in the system include
search path chain, its presence before the "-I../libdecnumber" was ignored by
the compiler, and its actual search order came after "../libdecnumber". There
are two different header files both named "config.h" in "libdecnumber" and
"gcc", so the compiler matches "../libdecnumber/config.h" instead of the
correct one "./config.h", which causes compilation to fail.

----
The workaround is to stop inserting "." in the system include search path
chain.

In file gcc-4.6.0/gcc/incpath.c, replace
path = xstrdup (".");
with
continue;

Note that after the change, the first stage compilation will still fail if the
host compiler has this problem. The workaround is:
1. Compile until failed
2. cd "host-xx-xx.../gcc"
3. mv ../libdecnumber/config.h ../libdecnumber/config.h-
4. Make in this directory (should complete without error)
5. mv ../libdecnumber/config.h- ../libdecnumber/config.h
6. cd ../..
7. Make again

The stage1 compiler will have this problem corrected, so the next 2 stages
should complete without error.

Reply via email to