Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#670 Problem with -I../../ when building/Multiple slash handling

Known_bugs
closed-fixed
Danny Smith
gcc (462)
2006-01-10
2004-10-24
No

Compiler seems to fail when attempting to add -I
with ../../ or ../ to include files one or two dirs above.
Same example works fine under Linux and Solaris.

Steps to recreate:

1) Untar the dir...
2) go down to the lowest dir where test.c is
3) type gcc -I../../ test.c

EXPECTED RESULT: Successful compile.
ACTUAL:
$ gcc -I../../ test.c
test.c:2:17: foo.h: No such file or directory
test.c: In function `main':
test.c:7: error: `ONE' undeclared (first use in this
function)
test.c:7: error: (Each undeclared identifier is reported
only once
test.c:7: error: for each function it appears in.)

I have some live examples of this happening.

However, when I do

gcc -I../.. test.c

Everything works. This seems to imply that MinGW
doesn't properly handle multiple slashes in a pathname,
which is a critical bug, if it's going to offer a UNIX
compatible build platform.

--- INFO
Windows 2000

$ gcc -v
Reading specs from
c:/GNUstep/Development/msys/1.0/mingw/bin/../lib/gcc/
mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-
ld --with-gnu-as --host=mingw32 --target=mingw32 --
prefix=/mingw --enable-threads --disable-nls --enable-
languages=c,c++,f77,ada,objc,java --disable-win32-
registry --disable-shared --enable-sjlj-exceptions --
enable-libgcj --disable-java-awt --without-x --enable-
java-gc=boehm --disable-libgcj-debug --enable-
interpreter --enable-hash-synchronization --enable-
libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)

$ ld -v
GNU ld version 2.13.90 20030111

MinGW version 3.1.0
MSYS version 1.0.10

Test case is attached.

#define __MINGW32_VERSION 3.1

#define __W32API_VERSION 2.4

Discussion

  • Simple example showing issue.

     
    Attachments
  • Earnie Boyd
    Earnie Boyd
    2004-10-24

    • assigned_to: earnie --> dannysmith
     
  • Danny Smith
    Danny Smith
    2004-10-24

    Logged In: YES
    user_id=11494

    I cannot reproduce the problem when running from DOS cmd
    shell or from zsh or cygwin bash.

    I suspect a msys shell problem. A similar problem was
    reported to gcc lists when using -I./ and was only observed
    with msys shell.

    Danny

    Danny

     
  • Danny Smith
    Danny Smith
    2004-10-24

    • assigned_to: dannysmith --> nobody
    • labels: 456608 --> 380073
     
  • Earnie Boyd
    Earnie Boyd
    2004-10-24

    • status: open --> open-accepted
     
  • Earnie Boyd
    Earnie Boyd
    2004-10-24

    Logged In: YES
    user_id=15438

    Ok, this is a bug in MSYS that I didn't know about. Anyone
    wishing to supply a patch for this bug, feel free to submit
    one. Hint, IIRC, Windows OS doesn't like c:/foo//bar so the
    trailing / on input needs stripped.

    Earnie

     
  • Earnie Boyd
    Earnie Boyd
    2004-10-24

    • assigned_to: nobody --> earnie
    • milestone: --> Known_bugs
    • priority: 5 --> 8
     
  • Logged In: YES
    user_id=209166

    My apologies as I didn't include this information. I was in
    the MSYS shell when I found the bug.

    Thanks, GJC

     
  • Earnie Boyd
    Earnie Boyd
    2005-02-23

    • status: open-accepted --> open
     
  • Earnie Boyd
    Earnie Boyd
    2005-02-23

    • priority: 8 --> 5
    • labels: 380073 --> gcc
    • assigned_to: earnie --> dannysmith
     
  • Earnie Boyd
    Earnie Boyd
    2005-02-23

    Logged In: YES
    user_id=15438

    Danny,

    I'm passing this bug back to you. After more testing I
    realized that gcc is the one that needs to strip the
    trailing slash from the -I argument. From the cmd.exe shell
    doing gcc -o test test.c -I..\..\ breaks the build. Doing
    gcc -o test test.c -I..\.. the build completes.

    Earnie

     
  • Danny Smith
    Danny Smith
    2005-02-23

    Logged In: YES
    user_id=11494

    Attached is a patch to gcc sources that should fix. It causes
    no regressions with NT4-sp5. I am not going to submit it to
    gcc lists because I don't have an XP or W2K to test.

    Feel free to submit a variant of this to gcc-patches.

    Danny

     
  • Danny Smith
    Danny Smith
    2005-02-23

    Patch against gcc sources

     
    Attachments
  • Onno Hommes
    Onno Hommes
    2005-06-20

    Logged In: YES
    user_id=122287

    All,

    I want to confirm this same problem. I currently have the
    same problem when I try to compile with the release of
    MinGW-4.1.0.exe

    This problem did not exist in gcc.exe (GCC) 3.2.3 (mingw
    special 20030504-1). MinGW-3.1.0-1.exe also doesn't seem to
    have
    this problem.

    Hope this gets fixed soon! (I am runningWin2K SP4).

     
  • Danny Smith
    Danny Smith
    2006-01-10

    • status: open --> closed-fixed
     
  • Danny Smith
    Danny Smith
    2006-01-10

    Logged In: YES
    user_id=11494

    Fixed in mingw gcc 3.4.5 RC
    Danny