error: incomplete definition of type 'struct dl_phdr_info'
phpstatic opened this issue · comments
phpstatic.com commented
get this build error from Debian:
clang -cc1 version 10.0.1 based upon LLVM 10.0.1 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
backtrace
/usr/local/include
/usr/lib/llvm-10/lib/clang/10.0.1/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
backtrace/elf.c:4812:23: warning: declaration of 'struct dl_phdr_info' will not be visible outside of this function [-Wvisibility]
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
^
backtrace/elf.c:4825:11: error: incomplete definition of type 'struct dl_phdr_info'
if (info->dlpi_name == NULL || info->dlpi_name[0] == '\0')
~~~~^
backtrace/elf.c:4812:23: note: forward declaration of 'struct dl_phdr_info'
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
^
backtrace/elf.c:4825:38: error: incomplete definition of type 'struct dl_phdr_info'
if (info->dlpi_name == NULL || info->dlpi_name[0] == '\0')
~~~~^
backtrace/elf.c:4812:23: note: forward declaration of 'struct dl_phdr_info'
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
^
backtrace/elf.c:4841:22: error: incomplete definition of type 'struct dl_phdr_info'
filename = info->dlpi_name;
~~~~^
backtrace/elf.c:4812:23: note: forward declaration of 'struct dl_phdr_info'
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
^
backtrace/elf.c:4842:40: error: incomplete definition of type 'struct dl_phdr_info'
descriptor = backtrace_open (info->dlpi_name, pd->error_callback,
~~~~^
backtrace/elf.c:4812:23: note: forward declaration of 'struct dl_phdr_info'
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
^
backtrace/elf.c:4848:62: error: incomplete definition of type 'struct dl_phdr_info'
if (elf_add (pd->state, filename, descriptor, NULL, 0, info->dlpi_addr,
~~~~^
backtrace/elf.c:4812:23: note: forward declaration of 'struct dl_phdr_info'
phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
^
backtrace/elf.c:4892:3: warning: implicit declaration of function 'dl_iterate_phdr' is invalid in C99 [-Wimplicit-function-declaration]
dl_iterate_phdr (phdr_callback, (void *) &pd);
^
2 warnings and 5 errors generated.
Ian Lance Taylor commented
dl_phdr_info
should be defined in <link.h>. Can you find out why that is not happening?
phpstatic.com commented
I can see dl_phdr_info from /usr/include/link.h
, but not sure why I get this error or how to fix it.
phpstatic.com commented
Add -D_GNU_SOURCE fix it.
Ian Lance Taylor commented
_GNU_SOURCE
should be defined by the generated file config.h.