0

This question may really be about where to get help, rather than help for the problem itself. Please forgive the wordiness!

I'm trying to build gcc to run on Win32 and produce code for AVR. I've started with the files used by the Arduino people to build their AVR tool chain.

Being on a windows machine, and that Atmel uses GCC 4.9.2 to build their current tool chain (which is then copied/patched) by the Arduino people, I've installed a MinGW system with a GCC at 4.9.2, downloaded the Arduino people's tool chain source and followed their directions (of course I've accidentally gotten something wrong, or somesuch?).

The ./configure stage of autoconf (actually G:\GNU-GCC\toolchain-avr\gcc\libgcc\configure) seems to successfully invoke a gcc several times, using a Win32 program called xgcc.exe that autoconf make placed in my gcc-build/gcc directory. The last successful run has -qversion for the compiler options.

The next run is the exact same invocation except it uses -o conftest -g -w -O2 -g0 -DWIN32 conftest.c as compiler options, and this time tries to fire off the compiler using exec -m.

This doesn't work, because the bash exec command doesn't have a -m option.

Note that xgcc.exe is a real program (not a script), and is compiled by the autoconf make step. It may be the cross compiler, as it gets copied to gcc-cross.exe. Therefore I assume that the autoconf launcher (M4 macro?) is causing the error.

Here's a part of config.log: (Look for the lines starting exec: usage: exec [-cl] [-a name] file ...

gcc version 4.9.2 (GCC) 
configure:3373: $? = 0
configure:3362: /g/gnu-gcc/toolchain-avr/gcc-build/./gcc/xgcc -B/g/gnu-gcc/toolchain-avr/gcc-build/./gcc/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/bin/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/lib/ -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/include -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/sys-include    -V 
xgcc.exe: error: unrecognized command line option '-V'
xgcc.exe: fatal error: no input files
compilation terminated.
configure:3373: $? = 1
configure:3362: /g/gnu-gcc/toolchain-avr/gcc-build/./gcc/xgcc -B/g/gnu-gcc/toolchain-avr/gcc-build/./gcc/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/bin/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/lib/ -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/include -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/sys-include    -qversion 
xgcc.exe: error: unrecognized command line option '-qversion'
xgcc.exe: fatal error: no input files
compilation terminated.
configure:3373: $? = 1
configure:3389: /g/gnu-gcc/toolchain-avr/gcc-build/./gcc/xgcc -B/g/gnu-gcc/toolchain-avr/gcc-build/./gcc/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/bin/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/lib/ -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/include -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/sys-include    -o conftest -g -w -O2 -g0 -DWIN32   conftest.c
g:/gnu-gcc/toolchain-avr/gcc-build/gcc/as: line 106: exec: -m: invalid option
exec: usage: exec [-cl] [-a name] file [redirection ...]
configure:3392: $? = 1
configure:3580: checking for suffix of object files
configure:3602: /g/gnu-gcc/toolchain-avr/gcc-build/./gcc/xgcc -B/g/gnu-gcc/toolchain-avr/gcc-build/./gcc/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/bin/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/lib/ -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/include -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/sys-include    -c -g -w -O2 -g0 -DWIN32  conftest.c
g:/gnu-gcc/toolchain-avr/gcc-build/gcc/as: line 106: exec: -m: invalid option
exec: usage: exec [-cl] [-a name] file [redirection ...]

Here's the section of gcc-build/gcc/libgcc/config that I believe produced the log.

# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
  { { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    sed '10a\
... rest of stderr output deleted ...
         10q' conftest.err >conftest.er1
    cat conftest.er1 >&5
    rm -f conftest.er1 conftest.err
  fi
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
done

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

At this point, I'm not sure where to go for help. The Arduino people have been non-responsive, and I don't know enough about autoconf to look for a problem in an autoconf.ac file, or in the autoconf code which generates ./config for the application, or the MC macros.

A scan for "exec" in the automake tools directory gave a zillion hits, none of which looked like an option was being added to "exec somethings...". But I know NOTHING about M4, and dread learning how to debug .ac files.

Suggestions, please?

0

The log tells you enough to see where to look. The error message comes from the assembler as as a result of executing line 3389 in the configure script:

configure:3389: /g/gnu-gcc/toolchain-avr/gcc-build/./gcc/xgcc -B/g/gnu-gcc/toolchain-avr/gcc-build/./gcc/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/bin/ -B/g/gnu-gcc/toolchain-avr/objdir/gcc/avr/lib/ -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/include -isystem /g/gnu-gcc/toolchain-avr/objdir/gcc/avr/sys-include    -o conftest -g -w -O2 -g0 -DWIN32   conftest.c
g:/gnu-gcc/toolchain-avr/gcc-build/gcc/as: line 106: exec: -m: invalid option

The assembler is executed based on a text-file which you may find mentioned if you turn on the verbose option (by editing the configure script, adding -v to the compiler flags). In your example, that could be this line:

(eval "$ac_compiler $ac_option >&5") 2>conftest.err

which you could modify to

(eval "$ac_compiler -v $ac_option ->&5") 2>conftest.err

Having found that, you might see the problem.

The xgcc program which we seem to be discussing is gcc built/linked as part of building gcc. That program will show its available options given the --help option (see source-code).

  • The "-v" option you suggest adding is processed as "version", not verbose. What might be useful is an option for gcc to document how it chooses what programs to run, which I am still searching for. – HiTechHiTouch Sep 20 '16 at 18:12
  • That sounds like double-dash --version. According to the source code, single-dash -v (and -###, which you would have to double-quote) should produce verbose output. – Thomas Dickey Sep 21 '16 at 1:30
  • @Dickey , apologies, missed your update. Digging further, I found -### option, and a note that -v will be propagated to all programs GCC invokes (preprocessor, linker, etc) to show a trace of what components are used. -### just prints the invocation line GCC produces for each component, without actually invoking it. I'm hoping to do the parameter fixup you suggest. There is also the GCC "-wrapper" option to substitute a shell. I'm thinking I can pin this down, but each test takes a lot of time! – HiTechHiTouch Sep 21 '16 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.