Jason Wilkins wrote:
> I am having problems with msys's path conversion. When it converts, it
> creates an absolute path, which messes things up when compiling cpp for
> gcc.
>
> This description is simplified...
>
> When compiling cpp is compiled, the include directory paths are passed
> into it from the command line. These directories are prefixed with the
> gcc tool directory (/lib/gcc-lib/ ), and then to get at the actual
> include directories, a relative part is added
> (/lib/gcc-lib/../../include).
>
> These way, when the compiler is moved, cpp can look for the prefix and
> replace it with the new path.
>
> Unfortunately, msys replaces /lib/gcc-lib/../../include with just
> c:/include, which has no prefix, so it does not get relocated, and my
> compiler ends up broken.
>
I'll have to take a look. I don't remember adding anything specific for
../ contained in the path other than if the path started with a relative
then I returned it unmodified. So, this may be legacy Cygwin coding
causing this to happen.
> Why does msys not keep the relative parts? I know that sometimes this
> will not be possible, but I really think that msys should complain and die
> in that case so that the user knows what is going on. In the other cases
> it should keep the relative parts just in case something actually needs
> them, like gcc.
>
> I noticed that if there is a backslash in the path
> (/lib/gcc-lib/../..\include), then it -does- keep the relative parts
> (c:/lib/gcc-lib/../../include). Why doesn't it do this all the time? I
> cannot use backslash because it breaks the build horribly.
>
If the path contains a backslash I assume it to be a Win32 path already
and pass back the path I received.
> Is msys used to compile mingw? If so, then what do they do to prevent
> this problem?
>
I have certainly compiled the native version of GCC without problems
using MSYS. Danny, though, uses a Linux cross-compiler.
> How can I tell msys not to do this? It seems that there is no way to
> escape a line so that it does not mangle something with a / in it.
>
There are no special flags, the best you can do is to help find the
problem in the MSYS source and suggest a patch. In the mean time I'll
add it to the round tuit list.
> The directories are passed to msys using
> -DINCLUDE_DIR=\"/lib/gcc-lib/../../include\"
>
> It appears that msys 1.0.9 converts this to:
> -DINCLUDE_DIR=\"c:/include\"
>
> But, 1.0.7 does what I think is better:
> -DINCLUDE_DIR=\"/lib/gcc-lib/../../include\"
>
> It leaves it alone, apparently because it is in quotes.
>
Thanks, I'll add these examples to the path regression tests. However,
you need to change the search for /lib itself within the program. What
you really need to do to find /lib is to find where the gcc binary is
being executed from and to /path/to/gcc/../lib/ where path represents
something like d:/mingw and d: represents the drive you have the
programs on. Otherwise /lib is relative to the current working device.
So using your above example, let's assume you're executing gcc from
``d:/mingw/bin'' where d: is any drive. So now your path above becomes
d:/mingw/bin/../lib/gcc-lib/../../include.
HTH,
Earnie.
|