在 gcc 4.1.2 (linux 5) 中运行 makefile 时,出现以下错误
make: yacc: Command not found
通过谷歌搜索,我知道可以通过安装 Bison-GNU 解析器生成器来纠正这个错误。但即使在安装 Bison 之后,我也会遇到同样的错误。
如何解决此错误?
在终端上运行以下命令来安装 bison、 yacc可执行文件和配置。yacc与野牛一起出现
您还需要byacc来获得功能齐全的yacc
sudo apt-get install bison -y
sudo apt-get install byacc -y
它对我有用。
From the looks of things, your makefile is expecting a yacc
executable to be available and either it's not, or it's not on your path.
Since bison
is supposed to be compatible with yacc
so the first thing I would try would be:
alias yacc="bison"
and try again. On my setup, /usr/bin/yacc
is simply a script containing:
#! /bin/sh
exec '/usr/bin/bison' -y "$@"
You can try to locate the yacc
or bison
executables with the command (substituting bison for yacc if need be):
which yacc
But they're probably in one of the standard places like /bin
or /usr/bin
.
我在 RHEL7 上遇到了类似的问题。
查找野牛在哪里:
$:which bison
*/bin/bison*
从 yacc 创建到 bison 的符号链接:
sudo ln -s /bin/bison /bin/yacc
这应该可以解决问题。
我在我的 Ubuntu 16 系统上创建了别名文件,然后在测试时我发现 bison 丢失了,所以我安装了 bison,这给了我一个关于我为 /usr/bin/yacc 创建的链接的错误,所以 bison 安装创建了lnk 文件本身用于 Ubuntu 16 上的 yacc。