-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Murphy wrote:
> 
> I'm totally at a loss to explain the problems Ranjit was experiencing in 
> this mail then.
> 
> http://gcc.gnu.org/ml/gcc/2006-04/msg00247.html
> 
> the part where he says " when run from within the MSYS environment, 
> everything was hunky-dory but when run from the Windows command prompt, 
> it used to give a "_spawnvp: No such file or directory" error when one 
> tried to compile something."

The difference is that MSYS automatically adds the "bin"
folder of MinGW to the PATH. On the Windows command prompt,
I was trying to execute "gcc" directly without having its
"bin" folder in the PATH - if I add that folder to the PATH,
things work fine again. In the problematic case, GCC is able
to find "cc1" but not "as":
- --------------------------- 8< ---------------------------
E:\src\tmp>d:\MiscAppz\MinGW\bin\gcc -v hello.c
Using built-in specs.
Target: i686-pc-mingw32
Configured with: ../gcc-4.1.0/configure --prefix=/mingw \
- --target=i686-pc-mingw32 --enable-languages=c,c++ \
- --disable-nls --disable-debug --enable-__cxa_atexit \
- --enable-threads=win32 --disable-win32-registry \
- --with-ld=/mingw/bin/ld.exe --with-as=/mingw/bin/as.exe
Thread model: win32
gcc version 4.1.0
 d:/miscappz/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.1.0/cc1.exe \
- -quiet -v -iprefix d:\miscappz\mingw\bin\../lib/gcc/i686-pc-mingw32/4.1.0/ \
hello.c -quiet -dumpbase hello.c -mtune=pentiumpro -auxbase hello \
- -version -o D:\TEMP/ccWCaaaa.s
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "d:/MiscAppz/MinGW/i686-pc-mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 d:/miscappz/mingw/bin/../lib/gcc/i686-pc-mingw32/4.1.0/include
 d:/MiscAppz/MinGW/include
 d:/MiscAppz/MinGW/lib/gcc/i686-pc-mingw32/4.1.0/include
End of search list.
GNU C version 4.1.0 (i686-pc-mingw32)
        compiled by GNU C version 4.1.0.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65462
Compiler executable checksum: ee311961bfecdede449f181caa4cf975
 as -o D:\TEMP/ccI5aaaa.o D:\TEMP/ccWCaaaa.s
gcc: _spawnvp: No such file or directory
- --------------------------- 8< ---------------------------
(Long lines broken up manually.)

Note that I *had* specified "--with-as", but I was using
UNIX-y paths which are *not* translated by MSYS for shell
scripts (unlike "regular" programmes):
- --------------------------- 8< ---------------------------
/e/src/tmp > cat hello.c
#include <stdio.h>

int main( int argc, char *argv[])
{
  if(argc > 1)
    printf( "argv[1]: %s\n", argv[1]);
  return 0;
}
/e/src/tmp > gcc hello.c
/e/src/tmp > ./a.exe /mingw
argv[1]: d:/MiscAppz/MinGW
/e/src/tmp > cat scr.sh
#!/bin/sh
echo $*
/e/src/tmp > ./scr.sh /mingw
/mingw
- --------------------------- 8< ---------------------------

Note also that GCC's programme search path does not include
its own location for some reason:
- --------------------------- 8< ---------------------------
d:/miscappz/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.1.0/
d:/miscappz/mingw/bin/../libexec/gcc/
d:/MiscAppz/MinGW/libexec/gcc/i686-pc-mingw32/4.1.0/
d:/MiscAppz/MinGW/libexec/gcc/i686-pc-mingw32/4.1.0/
d:/MiscAppz/MinGW/libexec/gcc/i686-pc-mingw32/
d:/MiscAppz/MinGW/lib/gcc/i686-pc-mingw32/4.1.0/
d:/MiscAppz/MinGW/lib/gcc/i686-pc-mingw32/
/usr/libexec/gcc/i686-pc-mingw32/4.1.0/
/usr/libexec/gcc/i686-pc-mingw32/
/usr/lib/gcc/i686-pc-mingw32/4.1.0/
/usr/lib/gcc/i686-pc-mingw32/
d:/miscappz/mingw/bin/../lib/gcc/i686-pc-mingw32/4.1.0/../../../../i686-pc-mingw
32/bin/i686-pc-mingw32/4.1.0/
d:/miscappz/mingw/bin/../lib/gcc/i686-pc-mingw32/4.1.0/../../../../i686-pc-mingw
32/bin/
d:/MiscAppz/MinGW/lib/gcc/i686-pc-mingw32/4.1.0/../../../../i686-pc-mingw32/bin/
i686-pc-mingw32/4.1.0/
d:/MiscAppz/MinGW/lib/gcc/i686-pc-mingw32/4.1.0/../../../../i686-pc-mingw32/bin/
- --------------------------- 8< ---------------------------

This is the more readable version of the "programs" section
of the output of "D:\MiscAppz\MinGW\bin\gcc -print-search-dirs".

See also PR bootstrap/22259:

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

The curious thing is that I could not find the message
in gcc-patches corresponding to CGF's patch and I cannot
find out who defines USE_MINGW_MSYS.

In any case, all this has been overridden in mainline by
a series of patches from Jim Blandy and Mark Mitchell,
though I haven't bootstrapped GCC mainline on MSYS.

Thanks,
Ranjit.

- --
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://rmathew.com/


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFETdPEYb1hx2wRS48RAtDvAJwIFIHe8LQUsFWD8BJ5H4HWlk6i/gCfQbnM
S872RVKUETmoMikS+ymG+30=
=7rQb
-----END PGP SIGNATURE-----

Reply via email to