无法在Ubuntu-9.10上安装libnet-0.10.11

时间:2011-01-27 05:21:30

标签: ubuntu libnet

这就是我做的......     #tar -xzvf libnet-0.10.11.tar.gz     #cd libnet

然后我将linux.mak文件复制到父目录中的port.mak文件中。 然后,正如文档所说,我在目前的目录中使用了make ...

naman@naman-laptop:~/Desktop/Software/libnet$ make
make -C lib/ lib
make[1]: Entering directory `/home/naman/Desktop/Software/libnet/lib'
gcc -O2 -Wall -Werror -Wno-unused -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g -I../include -Iinclude -DTARGET_LINUX   -c -o core/config.o core/config.c
cc1: warnings being treated as errors
core/config.c: In function ‘__libnet_internal__seek_section’:
core/config.c:87: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
core/config.c: In function ‘__libnet_internal__get_setting’:
core/config.c:111: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
make[1]: *** [core/config.o] Error 1
make[1]: Leaving directory `/home/naman/Desktop/Software/libnet/lib'
make: *** [lib] Error 2

任何人都可以详细向我解释错误,以及如何纠正错误?任何帮助将非常感激。

2 个答案:

答案 0 :(得分:1)

https://github.com/sam-github/libnet,这是一个古老的libnet版本,现代的使用autoconf,你需要使用这么旧的吗?

我建议从正在使用的makefile中删除-Wall-Werror

答案 1 :(得分:0)

看起来您正在尝试在较新的系统上编译较旧的库,并且自从编写此库以来已向gcc添加了新的警告。

由于Makefile将警告视为错误,(您可以告诉它打印cc1: warnings being treated as errors)警告warn_unused_result错误导致编译失败。

您可以选择:

  1. 编辑Makefile并删除所有-Werror参数
  2. 修复根本原因(代码中未使用的fgets()返回值)
  3. 查找要使用的其他库 - 为什么要在系统上使用此库(可能是未维护的)?
相关问题