Bug 22618 - bad diagnosis and recovery suggestion when bison or flex is missing
Summary: bad diagnosis and recovery suggestion when bison or flex is missing
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-16 17:35 UTC by John Reiser
Modified: 2017-12-16 17:37 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Reiser 2017-12-16 17:35:17 UTC
When building gdb on a system where bison or flex is not found in $PATH, then the error diagnosis and recovery suggestion is incomplete.  The suggestion forgets to say:
   Run "make clean" after installing [bison or flex] before continuing.

This causes needless bewilderment and lost time when subsequent 'make' complains about a missing file syslex.c.  Maintainers of the gdb package in various Linux distributions often encourage "file bug reports upstream" [namely, here at sourceware.org instead of at the distribution level].  Thus "gdb developer" often includes "ordinary users" who encounter problems with distributed packaged gdb.

Furthermore, checking for bison and flex should be part of the top-level ./configure for gdb, and not [only] in lower-level .../configure scripts.  By default, a complete top-level build does require both bison and flex; supplying them at first will avoid the necessity of "tending" the top-level 'make' interactively.  Add options "--without bison" and "--without flex" to the top-level 'configure' if desired to please those experienced developers who manage to avoid using bison and flex by excluding various sub-packages of gdb.

When doing a complete top-level build of gdb, then the bison diagnosis is:
=====
Making all in po
/home/jreiser/binutils-gdb/missing: line 81: bison: command not found
make[4]: Entering directory '/home/jreiser/binutils-gdb/gprof/po'
file=`echo bg | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file bg.po
WARNING: 'bison' is missing on your system.
         You should only need it if you modified a '.y' file.
         You may want to install the GNU Bison package:
         <http://www.gnu.org/software/bison/>
make[2]: *** [Makefile:986: arparse.c] Error 127
make[2]: *** Waiting for unfinished jobs....
file=`echo da | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file da.po
/home/jreiser/binutils-gdb/missing: line 81: bison: command not found
file=`echo de | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH /usr/bin/msgfmt -o $file de.po
WARNING: 'bison' is missing on your system.
         You should only need it if you modified a '.y' file.
         You may want to install the GNU Bison package:
         <http://www.gnu.org/software/bison/>
make[2]: *** [Makefile:986: sysinfo.c] Error 127
make[2]: Leaving directory '/home/jreiser/binutils-gdb/binutils'
=====

After installing bison, then re-running 'make' gives the flex diagnosis:
=====
/home/jreiser/binutils-gdb/missing: line 81: flex: command not found
updating sysinfo.h
WARNING: 'flex' is missing on your system.
         You should only need it if you modified a '.l' file.
         You may want to install the Fast Lexical Analyzer package:
         <http://flex.sourceforge.net/>
make[2]: *** [Makefile:983: syslex.c] Error 127
make[2]: *** Waiting for unfinished jobs....
gcc -DHAVE_CONFIG_H  -DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT     -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral   -DMODET   -I. -I. -I../common -I./../common -I../../include -I./../../include -I../../bfd -I./../../bfd -I../../opcodes -I./../../opcodes  -g -O2 -c -o version.o -MT version.o -MMD -MP -MF .deps/version.Tpo version.c
make[2]: Leaving directory '/home/jreiser/binutils-gdb/binutils'
=====

After installing flex, then re-running 'make' gives the error:
=====
gcc -c -I. -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -I./../zlib -g -O2 -Wno-error ./syslex_wrap.c
./syslex_wrap.c:25:10: fatal error: syslex.c: No such file or directory
 #include "syslex.c"
          ^~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1375: syslex_wrap.o] Error 1
make[2]: Leaving directory '/home/jreiser/binutils-gdb/binutils'
=====
That error takes a while to figure out.  The top-level ./configure should diagnose the lack of bison and flex.
Comment 1 John Reiser 2017-12-16 17:37:50 UTC
Source was git tip as of:
=====
commit 09da3ecf04d75084ea7d9c43e3cc0b18b2443ea3 (HEAD -> master, origin/master, origin/HEAD)
Author: GDB Administrator <gdbadmin@sourceware.org>
Date:   Sat Dec 16 00:00:33 2017 +0000

    Automatic date update in version.in

=====