binutils/bfd.h wants config.h now?

Viewed 6341

I'm trying to use the BFD library, and so I've installed package binutils-dev and have included:

#include <bfd.h>

and am calling bfd_openr and bfd_close and so on from my code.

Recently I have upgraded packages and now I get an error from here:

bfd.h:

/* PR 14072: Ensure that config.h is included first.  */
#if !defined PACKAGE && !defined PACKAGE_VERSION
#error config.h must be included before this header
#endif

...that I should include config.h - but I am not using autoconf.

Am I including the wrong header file? How are you supposed to use binutils-dev?

Here is a demo program:

#include <stdio.h>
#include <bfd.h>

int main()
{
    bfd_init();

    bfd* file = bfd_openr("a.out", 0);

    if (!file)
        return -1;

    if (bfd_check_format(file, bfd_object))
        printf("object file\n");
    else
        printf("not object file\n");

    bfd_close(file);

    return 0;
}

try to compile and run as follows:

$ sudo apt-get install binutils-dev
$ gcc test.c
In file included from test.c:3:0:
/usr/include/bfd.h:37:2: error: #error config.h must be included before this header
1 Answers
Related