Jacky Chen
Jacky Chen

Reputation: 127

elfutils compilation error implicit-function-declaration

I downloaded elfutils 0.170 and 0.169, but can't use gcc to compile either of them because of implicit-function-declaration. I can't find any place in elfutils makefile which specifies -Werror or -Werror=implicit-function-declaration. Any idea to fix this compilation error?

https://sourceware.org/elfutils/ftp/0.170/ My steps

1: bzip2 -d elfutils-0.170.tar.bz2 2: tar -xvf elfutils-0.170.tar 3: ./configure
4: make

Then below errors show up. elf_compress_gnu.c: In function 'elf_compress_gnu': elf_compress_gnu.c:114:28: error: implicit declaration of function 'htobe64' [-Werror=implicit-function-declaration] uint64_t be64_size = htobe64 (orig_size); ^ elf_compress_gnu.c:163:15: error: implicit declaration of function 'be64toh' [-Werror=implicit-function-declaration] gsize = be64toh (gsize); ^ cc1: all warnings being treated as errors

Upvotes: 4

Views: 528

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33694

elfutils incorrectly uses htobe64, which is not in any standard and only available in glibc and a subset of the BSDs.

Since you use GCC, you can use Ulf Hermann's patch to work around this issue:

It adds an implementation of htobe64 based on GCC built-in functions, so it is available when GCC is used as the compiler, independently of what the C library provides.

Upvotes: 2

Related Questions