【问题标题】:elfutils compilation error implicit-function-declarationelfutils 编译错误隐式函数声明
【发布时间】:2017-11-15 23:33:10
【问题描述】:

我下载了 elfutils 0.170 和 0.169,但由于隐式函数声明,无法使用 gcc 编译它们中的任何一个。我在 elfutils makefile 中找不到指定 -Werror 或 -Werror=implicit-function-declaration 的任何位置。有什么办法可以解决这个编译错误吗?

https://sourceware.org/elfutils/ftp/0.170/ 我的步骤

1: bzip2 -d elfutils-0.170.tar.bz2 2:焦油-xvf elfutils-0.170.tar 3:./配置
4:制作

然后出现以下错误。 elf_compress_gnu.c:在函数“elf_compress_gnu”中: elf_compress_gnu.c:114:28:错误:函数“htobe64”的隐式声明 [-Werror=implicit-function-declaration] uint64_t be64_size = htobe64 (orig_size); ^ elf_compress_gnu.c:163:15:错误:函数“be64toh”的隐式声明 [-Werror=implicit-function-declaration] gsize = be64toh (gsize); ^ cc1:所有警告都被视为错误

【问题讨论】:

    标签: c++ c gcc makefile


    【解决方案1】:

    elfutils 错误地使用了htobe64,它不在任何标准中,仅在 glibc 和 BSD 子集中可用。

    由于您使用 GCC,您可以使用 Ulf Hermann 的补丁来解决此问题:

    它基于 GCC 内置函数添加了htobe64 的实现,因此在使用 GCC 作为编译器时可用,与 C 库提供的无关。

    【讨论】:

    • 感谢您的回答。但我不想修补和更改 libgnu。 elfutils 有一个 elfutils-portabiliy.patch 来解决这个问题,但是这个补丁从 0.164 版本开始就消失了。任何想法来解决这个编译错误?而且我无法向 elfutils-devel@sourceware.org 发送电子邮件。我应该在哪里发送电子邮件来询问有关 elfutils 的问题?
    • 你要么需要应用类似这个补丁的东西,要么在 Linux 或受支持的 BSD 之一上编译。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    • 1970-01-01
    • 2015-09-27
    • 2013-03-20
    • 2018-06-11
    相关资源
    最近更新 更多