在 Ubuntu-9.10 上安装 libnet-0.10.11 时遇到问题

发布于 2024-10-14 15:43:51 字数 1023 浏览 2 评论 0原文

这就是我所做的...... #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

任何人都可以向我详细解释该错误以及如何纠正它吗?任何帮助将不胜感激。

Here's what I did...
#tar -xzvf libnet-0.10.11.tar.gz
#cd libnet

Then I copied the linux.mak file to the port.mak file in the parent directory.
Then, as the documentation says, I used make in the present directory...

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

Can anyone please explain the error to me in detail, and how to rectify it? Any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路终见情 2024-10-21 15:43:51

https://github.com/sam-github/libnet,这是一个古老的libnet版本,现代的都用autoconf,有必要用这么老的吗?

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

https://github.com/sam-github/libnet, that is an ancient libnet version, modern one uses autoconf, do you need to use such an old one?

I'd suggest removing both -Wall and -Werror from the makefile you are using.

已下线请稍等 2024-10-21 15:43:51

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

由于 Makefile 将警告视为错误,(您可以看出,因为它打印了 cc1:警告被视为错误)警告 warn_unused_result 错误导致编译失败。

您的选择是:

  1. 编辑 Makefile 并删除任何 -Werror 参数
  2. 修复根本原因(代码中未使用 fgets() 返回值)
  3. 查找要使用的不同库 -为什么你想在你的系统上使用这个(可能是未维护的)库?

It looks like you are trying to compile an older library on a newer system, and new warnings have been added to gcc since this library was written.

Since the Makefile has warnings treated as errors, (you can tell because it printed cc1: warnings being treated as errors) the warning warn_unused_result errors are causing the compile to fail.

Your options are to either:

  1. Edit the Makefile(s) and remove any -Werror parameter(s)
  2. Fix the root cause (unused fgets() return values in the code)
  3. Find a different library to use - why do you want to use this (presumably unmaintained) library on your system?
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文