麻烦构建gcc 4.6:未定义引用`yylex'

Chr*_*ris 31 gcc makefile bison

我正在尝试构建gcc 4.6,但是我收到了一些链接器错误,看起来这意味着bison或flex没有被链接到.当makefile发出以下命令时:

gcc   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE  -o build/gengtype \
        build/gengtype.o build/errors.o build/gengtype-lex.o build/gengtype-parse.o build/version.o ../../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a
Run Code Online (Sandbox Code Playgroud)

它告诉我:

/home/chris/code/gcc/trunk/host-x86_64-unknown-linux-gnu/gcc/../.././gcc/gengtype.c:960: undefined reference to `lexer_line'
... undefined reference to `yylex'
... undefined reference to `yybegin'
... undefined reference to `yyend'
Run Code Online (Sandbox Code Playgroud)

我已经安装了Flex和Bison,甚至尝试了几种具有相同结果的Bison变体.有谁知道这可能意味着什么?

Ric*_*bit 47

同样的事情发生在我身上,这是由于缺乏弹性和野牛.安装flex和野牛后,我跑make distclean./configure,然后将其编译的罚款.

  • 啊哈,make*distclean*.我试过一个`make clean`,但那没用.我正打算像@Chris建议的那样尝试从轨道上进行核武器,但这也很有用. (6认同)
  • gcc安装文档建议不要在源目录中运行configure.如果你从另一个目录运行../gcc-srcdir/configure,那么源目录保持不变,你可以删除整个obj目录.这比"make distclean"更可靠(也更快) (3认同)
  • 为什么 configure 不会警告缺少 flex?[对 GMP 如此挑剔!](http://stackoverflow.com/questions/9253695/building-gcc-requires-gmp-4-2-mpfr-2-3-1-and-mpc-0-8- 0) (2认同)