4

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer. But I don't want to patch and change libgnu. There was a elfutils-portabiliy.patch for elfutils to solve this issue but this patch had disappeared since 0.164 version. Any idea to fix this compilation error? And I can't send email to [email protected]. Where should I send email to ask question on elfutils?
You either need to apply something like this patch or compile on Linux or one of the supported BSDs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.