What's going on?

Sorry for the horizontal scrolling involved!

I'm using cygwin to build a gcc cross-compiler on my Windows 7 64-bit to target arm-none-eabi, and I'm having some strange issues with compiling the prerequisites. I've already had the issue with binutils and worked around it, now I am having the issue again with gmp.

What happens is that when running make, it will display a command that it is executing, and the command will fail. However if I run the command myself it succeeds, and then I can run make again and get to the next command, and the same thing happens over and over. With binutils the issue was that an extra backslash was being added at the end of a quoted path, escaping the quote, but running the command myself this doesn't happen.

Now with gmp it's even weirder. This is what happens when running make:
C:/cygwin/bin/sh.exe ../libtool --mode=compile --tag=CC ../../mpn/m4-ccas --m4="m4" gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. -DOPERATION_`echo add_n | sed 's/_$//'`    -O2 -pedantic -fomit-frame-pointer -m64 -mtune=bdver1 -march=bdver1  `test -f 'add_n.asm' || echo '../../mpn/'`add_n.asm
libtool: compile:  ../../mpn/m4-ccas "--m4=m4 gcc" -std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. -DOPERATION_add_n -O2 -pedantic -fomit-frame-pointer -m64 -mtune=bdver1 -march=bdver1 add_n.asm -o add_n.o
m4 gcc  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_add_n add_n.asm >tmp-add_n.s
C:\m4\bin\m4.exe: cannot open `gcc': No such file or directory
make[2]: *** [add_n.lo] Error 1
make[2]: Leaving directory `C:/Users/Nicholas/Code/gmp-5.1.3/build/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `C:/Users/Nicholas/Code/gmp-5.1.3/build'
make: *** [all] Error 2
Notice in the command this part:
--m4="m4" gcc
Which for whatever reason is translating into this in the libtool invocation:
"--m4=m4 gcc"

If I run the command myself, this happens instead:
$ C:/cygwin/bin/sh.exe ../libtool --mode=compile --tag=CC ../../mpn/m4-ccas --m4="m4" gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. -DOPERATION_`echo add_n | sed 's/_$//'`    -O2 -pedantic -fomit-frame-pointer -m64 -mtune=bdver1 -march=bdver1  `test -f 'add_n.asm' || echo '../../mpn/'`add_n.asm
libtool: compile:  ../../mpn/m4-ccas --m4=m4 gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. -DOPERATION_add_n -O2 -pedantic -fomit-frame-pointer -m64 -mtune=bdver1 -march=bdver1 add_n.asm -o add_n.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_add_n add_n.asm >tmp-add_n.s
 gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. -DOPERATION_add_n -O2 -pedantic -fomit-frame-pointer -m64 -mtune=bdver1 -march=bdver1 tmp-add_n.s -o add_n.o
It removes the quotes altogether, which is fine, and it works properly.

Now I have just about had it with this - I have been running every one of these commands myself because for whatever reason this strange behavior is occurring. Any ideas? This is how I configured gmp:
../configure --prefix=/cygdrive/c/Users/Nicholas/Code/gmp-5.1.3/installation M4=m4
(run from a "build" subfolder).
This workaround, replacing "$(M4)" with just $(M4) is working - I had to do a similar workaround with binutils but it was more painful.

Why is this even happening, though? What can I d to make sure it doesn't keep happening with the other two prerequisites I have to build and gcc itself?
Topic archived. No new replies allowed.