#264 Error w/ cross-GCC after build with msys 1.0.8.

closed-fixed
Earnie Boyd
MSYS (75)
2004-03-30
2003-01-21
Eric Weddington
No

I build a cross-GCC for the AVR target. Everything works great on msys-1.0.8-rc-2. When I upgraded to
msys-1.0.8 (released), building avr-gcc went fine, however the avr-gcc could now not find any of the avr
system header files or the gcc system headers.

This was confirmed with the 20021209 snapshot of GCC 3.3 and the 20030113 snapshot of GCC 3.3
(which is marked as prerelease). In both cases the avr-gcc built fine on msys-1.0.8-rc-2 and behaved
correctly. They both built fine with msys-1.0.8 (released) but both did not behave correctly in that they
could not find system header files. When I took a version of GCC and built it with msys-1.0.8 (released)
and msys-1.0.8-rc-2 I did notice a size difference with the cc1.exe component between the two builds.

Please CC eric@umginc.net as I'm not able to subscribe to any mingw mailing lists. Thanks.

Eric Weddington

Discussion

  • Jason Wilkins
    Jason Wilkins
    2003-03-30

    Logged In: YES
    user_id=650608

    I am having this same problem, and I tracked it to the way
    msys converts paths into dos paths. The problem is that it
    takes all the relative path stuff out of it, so the paths passed
    into cpp0.exe as include paths no longer the proper prefix
    which is needed for them to be rewritten when you relocate
    the compiler to a different directory.

     
  • Jason Wilkins
    Jason Wilkins
    2003-03-30

    Logged In: YES
    user_id=650608

    When I said 'passed into' I meant 'built into'

    When cppdefaults.c is built, the paths passed into have
    relative paths which are important to the way it works. msys
    screws these paths up so that they do not work properly if
    you move the resulting cpp from a different directory.

    The solution, i think, is to have msys be smarter about paths
    and not remove ".."

     
  • Earnie Boyd
    Earnie Boyd
    2003-03-30

    Logged In: YES
    user_id=15438

    Please provide a simple test case.

    Earnie.

     
  • Jason Wilkins
    Jason Wilkins
    2003-03-31

    Logged In: YES
    user_id=650608

    -- Makefile

    -- pathtest.c
    #include <stdio.h>all: pathtest.exe
    ./pathtest

    pathtest.exe: pathtest.c
    gcc -DPREFIX=\"/prefix/lib/gcc-lib/arm-elf/3.2.2/\" -
    DTEST_INCLUDE_DIR=\"/prefix/lib/gcc-lib/arm-
    elf/3.2.2/../../../../arm-elf/include/\" -o pathtest pathtest.c

    #include <string.h>

    /* When cppdefault.c, a part of cpp0 (the c preprocesor) is
    compiled,
    the paths in which to look up system include files are
    defined on
    the command line using -D and built into it. These paths
    need to
    start with the gcc lib directory as a prefix or cpp0 will not
    know
    that they need to be rewritten if the toolchain is relocated
    after it is compiled.

    msys rewrites filenames on the command line to conform
    with win32.
    This rewriting needs to take place in a certain way in order
    for
    cpp0 to get paths with the proper prefix.

    For example, if cppdefault.c is compiled with:

    -DINCLUDE_DIR="/prefix/lib/gcc-lib/arm-
    elf/3.2.2/../../../../include"

    /prefix/lib/gcc-lib/arm-elf/3.2.2 is the prefix that tells cpp0
    to rewrite the path if the compiler is moved.

    This prefix would have been rewritten earlier by msys to be:

    c:/msys/1.0/prefix/lib/gcc-lib/arm-elf/3.2.2/

    To behave correctly, msys should rewrite the -D option
    above to:

    c:/msys/1.0/prefix/lib/gcc-lib/arm-elf/3.2.2/../../../../include

    However, msys 1.0.8 rewrites the -D option to:

    c:/msys/1.0/prefix/include

    This is the correct directory, but it no longer begins with the
    prefix. The resulting cpp0 will not work if it is moved
    because
    it will not recognize that the directory needs to be rewritten.

    msys needs to leave the ../.. parts in the path so that the
    prefix remains intact.

    This test case should be compiled using the command line
    options:
    -DPREFIX="/prefix/lib/gcc-lib/arm-elf/3.2.2/"
    -DTEST_INCLUDE_DIR="/prefix/lib/gcc-lib/arm-
    elf/3.2.2/../../../../arm-elf/include/"

    The program will test to see if TEST_INCLUDE_DIR begin
    with the
    prefix. If not then msys has improperly mangled the
    filename.

    */

    #ifndef PREFIX
    #error Please pass in -DPREFIX="something"
    #endif

    #ifndef TEST_INCLUDE_DIR
    #error Please pass in -
    DTEST_INCLUDE_DIR="/prefix/../../something"
    #endif

    int main(void)
    {
    printf("PREFIX=%s\n", PREFIX);
    printf("TEST_INCLUDE_DIR=%s\n", TEST_INCLUDE_DIR);

    if (strncmp(PREFIX, TEST_INCLUDE_DIR, strlen(PREFIX))
    == 0) {
    puts("passed!");
    return 0;
    }
    else {
    puts("failed!");
    return -1;
    }
    }

     
  • Jason Wilkins
    Jason Wilkins
    2003-03-31

    Logged In: YES
    user_id=650608

    Opps, I sort of messed that up. ^_^

     
  • Logged In: YES
    user_id=543419

    I've noticed that MSYS 1.0.9 is released. Any word when this
    bug can be fixed? Thanks.

    Eric Weddington <eric@ecentral.com>

     
  • Logged In: YES
    user_id=543419

    Again, any idea when this bug might be fixed?
    Thanks
    Eric

     
  • Earnie Boyd
    Earnie Boyd
    2004-02-24

    Logged In: YES
    user_id=15438

    Eric, Do you still have a problem? Does it exist with the
    1.0.10-rc-4 candidate?

    Earnie

     
  • Earnie Boyd
    Earnie Boyd
    2004-02-24

    • priority: 5 --> 8
     
  • Earnie Boyd
    Earnie Boyd
    2004-03-11

    Logged In: YES
    user_id=15438

    Please give the 1.0.10-rc-5 candidate a try. This should be
    resolved.

    Earnie.

     
  • alan johnson
    alan johnson
    2004-03-17

    Logged In: YES
    user_id=943591

    this i think might need more
    thought

     
  • Earnie Boyd
    Earnie Boyd
    2004-03-30

    Logged In: YES
    user_id=15438

    Based on the jasonwilkins sample code this is now fixed.

    Earnie

     
  • Earnie Boyd
    Earnie Boyd
    2004-03-30

    • status: open --> closed-fixed