public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56686] New: gcc cannot find include header file
@ 2013-03-22  2:18 panruochen at gmail dot com
  2013-03-22  2:19 ` [Bug c/56686] " panruochen at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: panruochen at gmail dot com @ 2013-03-22  2:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

             Bug #: 56686
           Summary: gcc cannot find include header file
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: panruochen@gmail.com


GCC fails in the following case:
a. Current directory is TopDir
b. gcc tries to compile some source file in sub directory SubDir
c. the source file includes a header file in TopDir
d. -I./ flag is set

gcc still reports: fatal error: xxx.h: No such file or directory

My gcc version information is as followed:
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.2/configure
--enable-languages=c,c++,ada,fortran,objc,obj-c++
--disable-sjlj-exceptions --with-dwarf2 --enable-shared
--enable-libgomp --disable-win32-registry --enable-libstdcxx-debug
--enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.6.2 (GCC)

The error cannot be seen in any older version. The sample source and makefile
is attached.


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

* [Bug c/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
@ 2013-03-22  2:19 ` panruochen at gmail dot com
  2013-03-22  2:26 ` [Bug preprocessor/56686] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: panruochen at gmail dot com @ 2013-03-22  2:19 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

--- Comment #1 from Pan Ruochen <panruochen at gmail dot com> 2013-03-22 02:18:58 UTC ---
Created attachment 29706
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29706
testcase

Testcase for this bug


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
  2013-03-22  2:19 ` [Bug c/56686] " panruochen at gmail dot com
@ 2013-03-22  2:26 ` pinskia at gcc dot gnu.org
  2013-03-22  6:54 ` ktietz at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-22  2:26 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |preprocessor
               Host|                            |*mingw*

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-22 02:26:13 UTC ---
Can you add -v and provide the output while invoking gcc like:
gcc -I./ -c -o main.o d1/main.c -v

This might be a mingw specific bug.
It works for me on linux on the trunk.


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
  2013-03-22  2:19 ` [Bug c/56686] " panruochen at gmail dot com
  2013-03-22  2:26 ` [Bug preprocessor/56686] " pinskia at gcc dot gnu.org
@ 2013-03-22  6:54 ` ktietz at gcc dot gnu.org
  2013-03-25  3:21 ` panruochen at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2013-03-22  6:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ktietz at gcc dot gnu.org
         Resolution|                            |WORKSFORME

--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> 2013-03-22 06:53:17 UTC ---
Sorry can't reproduce your issue.  I tested it with 4.6 up to 4.8 gcc version
 'gcc -c -o t.o subsub/t.c -I.' without issues.

I assume it might be caused that your working-directory isn't at TopDir, but in
SubDir on compilation of your code.   You can verify that by adding -I.. as
option.


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-22  6:54 ` ktietz at gcc dot gnu.org
@ 2013-03-25  3:21 ` panruochen at gmail dot com
  2013-03-25  3:28 ` panruochen at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: panruochen at gmail dot com @ 2013-03-25  3:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

--- Comment #4 from Pan Ruochen <panruochen at gmail dot com> 2013-03-25 03:21:34 UTC ---
I find something interesting:

With -I.  option, gcc works well.
With -I./ option, gcc fails.

gcc -v says:
ignoring nonexistent directory "./"

But even on Windows, both "." and "./" stand for "current directory", don't
they?


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
                   ` (3 preceding siblings ...)
  2013-03-25  3:21 ` panruochen at gmail dot com
@ 2013-03-25  3:28 ` panruochen at gmail dot com
  2013-03-25  3:29 ` panruochen at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: panruochen at gmail dot com @ 2013-03-25  3:28 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

--- Comment #5 from Pan Ruochen <panruochen at gmail dot com> 2013-03-25 03:28:24 UTC ---
Created attachment 29716
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29716
screen snapshot


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
                   ` (4 preceding siblings ...)
  2013-03-25  3:28 ` panruochen at gmail dot com
@ 2013-03-25  3:29 ` panruochen at gmail dot com
  2013-04-25 14:09 ` lostdj at gmail dot com
  2013-12-07 11:46 ` ktietz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: panruochen at gmail dot com @ 2013-03-25  3:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

Pan Ruochen <panruochen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WORKSFORME                  |

--- Comment #6 from Pan Ruochen <panruochen at gmail dot com> 2013-03-25 03:29:24 UTC ---
This error does exist on my environment.
And found more details.


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
                   ` (5 preceding siblings ...)
  2013-03-25  3:29 ` panruochen at gmail dot com
@ 2013-04-25 14:09 ` lostdj at gmail dot com
  2013-12-07 11:46 ` ktietz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: lostdj at gmail dot com @ 2013-04-25 14:09 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

--- Comment #7 from lostdj at gmail dot com 2013-04-25 14:09:41 UTC ---
Created attachment 29939
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29939
testcase

It's funny that I just wanted to report almost identical issue. Can't believe
no one had encountered this before.

MinGW, GCC 4.7.0.
Attached test case is a bit different from author's original, yet similar:
"inc1.h: No such file or directory"
If you change one include path in makefile from -I./ to -I., everything
compiles without errors.

>From gcc -v with -I./:
#include "..." search starts here:
#include <...> search starts here:
 ./inc
 d:\bin\mingw\bin\../lib/gcc/mingw32/4.7.0/include
 d:\bin\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include
 d:\bin\mingw\bin\../lib/gcc/mingw32/4.7.0/include-fixed

And -I.:
#include "..." search starts here:
#include <...> search starts here:
 ./inc
 .
 d:\bin\mingw\bin\../lib/gcc/mingw32/4.7.0/include
 d:\bin\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include
 d:\bin\mingw\bin\../lib/gcc/mingw32/4.7.0/include-fixed

***

Aaand on Linux with GCC 4.4.6 everything is fine. No errors. 
-v -I./:
#include "..." search starts here:
#include <...> search starts here:
 ./inc/
 ./
 /usr/local/include
 /usr/lib/gcc/i686-redhat-linux/4.4.6/include
 /usr/include

-v -I.:
#include "..." search starts here:
#include <...> search starts here:
 ./inc/
 .
 /usr/local/include
 /usr/lib/gcc/i686-redhat-linux/4.4.6/include
 /usr/include

***

So whom is to blame: GCC or MinGW?


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

* [Bug preprocessor/56686] gcc cannot find include header file
  2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
                   ` (6 preceding siblings ...)
  2013-04-25 14:09 ` lostdj at gmail dot com
@ 2013-12-07 11:46 ` ktietz at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2013-12-07 11:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56686

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #8 from Kai Tietz <ktietz at gcc dot gnu.org> ---
That is a MinGW.org issue.  For mingw-w64 this issue is fixed.  Well, actually
it is under the hood a msvcrt issue about stat-routines.  Sadly it can't handle
proper trailing slashes on paths.

To verify the issue simply check following test program:
#include <io.h>
#include <sys/stat.h>
#include <stdio.h>

int main()
{
  struct stat fb;
  if (stat ("./", &fb))
   printf ("'./' stat failed.\n");
  return 0;
}

I close this bug as invalid, due it isn't caused, nor to be fixed by gcc.


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

end of thread, other threads:[~2013-12-07 11:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22  2:18 [Bug c/56686] New: gcc cannot find include header file panruochen at gmail dot com
2013-03-22  2:19 ` [Bug c/56686] " panruochen at gmail dot com
2013-03-22  2:26 ` [Bug preprocessor/56686] " pinskia at gcc dot gnu.org
2013-03-22  6:54 ` ktietz at gcc dot gnu.org
2013-03-25  3:21 ` panruochen at gmail dot com
2013-03-25  3:28 ` panruochen at gmail dot com
2013-03-25  3:29 ` panruochen at gmail dot com
2013-04-25 14:09 ` lostdj at gmail dot com
2013-12-07 11:46 ` ktietz 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).