jq 编译错误 configure: error: You need bison version 3.0 or greater

Linux 2020-06-18 阅读 52 评论 0

问题描述

下载 jq 远吗并编译,命令如下:

$ git clone https://github.com/stedolan/jq.git
$ cd jq
$ git submodule update --init
$ ./configure --prefix=/Volumes/develop/opt/jq

最后出错中止了

checking for bison version... 2.3
configure: error: You need bison version 3.0 or greater, or use --disable-maintainer-mode.

在运行 make -j8 命令中,也可能会出现以下错误。

YACC     src/parser.c
./config/ylwrap:行176: yacc: 未找到命令

解决方法

需要下载 3.0 以上的 bison

源码安装

源码安装适合 Mac OS 和各 LInux 版本。可前往 https://www.gnu.org/software/bison/ 下载最新版本 bison,如 bison-3.6.tar.xz,安装:

$ wget ftp://ftp.gnu.org/gnu/bison/bison-3.6.tar.xz
$ tar xf bison-3.6.tar.xz
$ cd bison-3.6
$ ./configure
$ make
$ make install

命令行安装

  • RHEL/CentOS 8

在 Linux 8以上,可以直接运行 yum 命令。

sudo yum install bison
  • Ubuntu/Debian

运行 apt-get 命令

apt-get install bison
 
$ git clone https://github.com/stedolan/jq.git
$ cd jq
$ git submodule update --init
$ ./configure --prefix=/Volumes/develop/opt/jq
 
最后更新 2020-07-17