public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48910] New: Current working directory in system include search path
@ 2011-05-06  5:34 Adam_5Wu at Hotmail dot com
  2011-05-06 10:59 ` [Bug c/48910] " joseph at codesourcery dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Adam_5Wu at Hotmail dot com @ 2011-05-06  5:34 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: Adam_5Wu@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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-23 23:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-06  5:34 [Bug c/48910] New: Current working directory in system include search path Adam_5Wu at Hotmail dot com
2011-05-06 10:59 ` [Bug c/48910] " joseph at codesourcery dot com
2011-05-06 20:11 ` Adam_5Wu at Hotmail dot com
2011-07-23 23:15 ` pinskia at gcc dot gnu.org

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).