源码地址 https://ftp.gnu.org/gnu/bison/

编译指令  ./configure &&make

src目录下生成可执行程序:bison yacc

测试环境 CentOS Linux release 7.7.1908 (Core)  gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

测试环境 CentOS Linux release 7.8.2003 (AltArch) gcc (GCC) 8.2.0


测试通过的版本:

bison-3.4.2.tar.xz

bison-3.0.5.tar.xz

bison-3.4.tar.xz



注意

1)之前测试存在异常版本bison-3.4.tar.xz,环境已经无法确定

出错信息

tests/bison: line 37: 16925 Segmentation fault      (core dumped) $PREBISON "$abs_top_builddir/src/bison" ${1+"$@"} 2> "$stderr"
make[2]: *** [Makefile:6774: doc/bison.help] Error 139


2)error: possibly undefined macro: AC_PROG_GNU_M4

configure.ac:233: error: possibly undefined macro: AC_PROG_GNU_M4

      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/local/bin/autoconf failed with exit status: 1
./bootstrap: autoreconf failed


bison-3.4/m4/m4.m4定义了 AC_PROG_GNU_M4宏定义


# AC_PROG_GNU_M4
# --------------
# Check for GNU M4, at least 1.4.6 (all earlier versions had bugs in
# trace support and regexp support):
# https://lists.gnu.org/archive/html/bug-gnu-utils/2006-11/msg00096.html
# https://lists.gnu.org/archive/html/bug-autoconf/2009-07/msg00023.html
# Also, check whether --error-output (through 1.4.x) or --debugfile (2.0)
# is supported, and AC_SUBST M4_DEBUGFILE accordingly.
# Also avoid versions of m4 that trigger strstr bugs.
AC_DEFUN([AC_PROG_GNU_M4],
  [AC_ARG_VAR([M4], [Location of GNU M4 1.4.6 or later.  Defaults to the first
    program of 'm4', 'gm4', or 'gnum4' on PATH that meets Autoconf needs.])
  AC_CACHE_CHECK([for GNU M4 that supports accurate traces], [ac_cv_path_M4],
    [rm -f conftest.m4f
ac_had_posixly_correct=${POSIXLY_CORRECT:+yes}
AS_UNSET([POSIXLY_CORRECT])
AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4],