All tools built from sources and used successfully for building other software. gcc-3.4.2 bison-1.875 host binutils-2.14.90.0.4.1 glibc-2.3.3 Trying to build binutils-2.15.91.0.2 (similar problem noted but not reported with 2.15.91.0.1) obtained from kernel.org. Fails on linking ar. binutils was configured with --prefix but otherwise as adviced in INSTALL. (snip) gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -ldl ar.o(.text+0x1020): In function `main': ../../binutils-2.15.91.0.2/binutils/ar.c:342: multiple definition of `main' arlex.o(.text+0x0):/s/build-binutils/binutils/arlex.c:1: first defined here /apps/binutils/std/bin/ld: Warning: size of symbol `main' changed from 16 in arlex.o to 3488 in ar.o bucomm.o(.text+0xa06): In function `make_tempname': ../../binutils-2.15.91.0.2/binutils/bucomm.c:425: the use of `mktemp' is dangerous, better use `mkstemp' arparse.o(.text+0x39): In function `yyerror': /s/build-binutils/binutils/../../binutils-2.15.91.0.2/binutils/arparse.y:201: undefined reference to `linenumber' arparse.o(.text+0x402): In function `yyparse': /s/build-binutils/binutils/y.tab.c:1004: undefined reference to `yylex' collect2: ld returned 1 exit status make[3]: *** [ar] Error 1 make[3]: Leaving directory `/d/src/build-binutils/binutils' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/d/src/build-binutils/binutils' make[1]: *** [all-recursive-am] Error 2 make[1]: Leaving directory `/d/src/build-binutils/binutils' make: *** [all-binutils] Error 2 --Sampo
I checked with bison-1.35. It repeats the same. Thus my hunch that it was bison version related does not appear to be right. Where is the symbol linenumber supposed to be defined? --Sampo
This looks fairly obviously a problem with your binutils/arlex.c, a file created by flex from binutils/arlex.l
Can you reproduce this problem with binutils-2.15?
You don't seem to be using an FSF release of binutils. Nevertheless, a release should not require you to have flex or bison installed in order to build binutils. Please try to use an FSF release like 2.15 and re-open this PR if the problem persists for you.
FYI, I saw this on a recently installed machine when building binutils CVS HEAD. Installing flex (and bison) made the problem go away for me.
Yes, building from CVS requires that you have flex and bison installed. The reason is that files generated by flex and bison are not kept up-to-date in the CVS repository.
Actually, the generated files aren't kept in CVS at all!