flex是和bison一样,是一种强大精悍的语法解析编译工具。是unix环境下分析工具lex的GNU版本。
flex库在使用openvpn时被依赖,交叉编译openvpn时,一直报错:
yywrap()函数未定义。
ld链接flex库时找不到libfl.a libfl_pic.a. 等错误。
最终是因为没有交叉编译生成的静态库文件libfl.a 和 libfl_pic.a。
所以得交叉编译flex,我使用的是flex_2.5.35版.
mips平台上交叉编译:
./configure --host=mipsel-linux
make
会在主目录下生成 libfl.a 和 libfl_pic.a
make install
会安装到 --prefix指定的目录。
编译时报错:
undefined reference -to 'rpl_malloc'
undefined reference to 'rpl_realloc'
这是因为在config.h中定义了
#define malloc rpl_malloc
#define realloc rpl_realloc
把这两句注释掉就能顺利编译通过了。