bfd.h should have included libiberty/ansidecl.h in Ubuntu 14.04?
binutils package seems to be changed, as it includes directory of libiberty.h
has moved to /usr/include/libiberty
, thus there is possible a wrong include in bfd.h
regarding ansidecl.h
.
Getting those compile errors when using binutils trace utilities
/usr/include/libiberty/libiberty.h: In function ‘basename’:
/usr/include/libiberty/libiberty.h:110:38: error: expected declaration specifiers before ‘ATTRIBUTE_RETURNS_NONNULL’
extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
^
/usr/include/libiberty/libiberty.h:121:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ATTRIBUTE_RETURNS_NONNULL’
extern const char *lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
^
/usr/include/libiberty/libiberty.h:126:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ATTRIBUTE_RETURNS_NONNULL’
extern const char *dos_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
^
/usr/include/libiberty/libiberty.h:132:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ATTRIBUTE_RETURNS_NONNULL’
extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
By changing bfd.h
to include /usr/include/libiberty/ansidecl.h
, everything went fine in my compilation.
Please, any hints for this issue? Thanks.
Solution 1:
As reported by Eduardo Abinader (the author of question) and Shaun Jackman as Bug 58689 and MSG 00135 respectively, concluding from exchanged data...
This is an issue caused by older library installation on Ubuntu system, I guess it is fault of neither Ubuntu nor binutils, but looks like System Update issue. Solution is included in question itself.
PS: But, the main thing is we had an answer back then and now. More details can be found on Links! Please improve this answer if required. :)