Discussion:
bdf.h requires config.h
(too old to reply)
Benson Muite
2018-11-28 18:13:19 UTC
Permalink
Hi,

Am using an application that utilizes binutils, and in particular calls
the bfd.h header file when compiling.  Have built binutils-2.3.1 from
source. In this version of binutils, bfd.h seems to require a
configure.h header file. If I comment out lines 34,35 and 36 in bdf.h
which are:

#if !defined PACKAGE && !defined PACKAGE_VERSION
#error config.h must be included before this header
#endif
 

my target application compiles. What information do PACKAGE,
PACKAGE_VERSION and config.h provide and would there be any other
mechanisms to provide this information that might be more portable?

This issue seems to have been raised before:
https://sourceware.org/bugzilla/show_bug.cgi?id=15920
https://bugzilla.redhat.com/show_bug.cgi?id=845084
https://github.com/HPCToolkit/hpctoolkit-externals/blob/master/binutils/patches-27/pa
Nick Clifton
2018-11-29 11:20:30 UTC
Permalink
Hi Benson,
the bfd.h header file when compiling. Have built binutils-2.3.1 from
Just to be clear, do you mean binutils version 2.31 rather than 2.3.1 ?
Version 2.3.1 would be extremely old...
source. In this version of binutils, bfd.h seems to require a
configure.h header file.
Again, just to be clear. Do you mean "config.h" rather than "configure.h".
As far as I know there is no header file called "configure.h".
What information do PACKAGE,> PACKAGE_VERSION and config.h provide
The PACKAGE and PACKAGE_VERSION definitions would normally
be "binutils" and the version of binutils being built.

config.h however is much more than that. It contains a whole
series of pre-processor declarations that are set if a particular
feature is present in the build environment. So for example
HAVE_LONG_LONG is defined if the compiler supports the "long long"
type and HAVE_SYS_TIME_H is defined if the <sys/time.h> header file
is available.

See also this PR for more details:

https://sourceware.org/bugzilla/show_bug.cgi?id=14072
and would there be any other
mechanisms to provide this information that might be more portable?
The config.h header file is normally generated by running the
configure script at the top level of the binutils sources. This
script is intended to be portable to a very wide variety of systems.

So in essence the answer to your question is no, there is no better
way to provide this information.

Cheers
Nick
Benson Muite
2018-11-29 13:16:52 UTC
Permalink
Hi Nick,

Thanks for your answers.
Post by Nick Clifton
Hi Benson,
the bfd.h header file when compiling. Have built binutils-2.3.1 from
Just to be clear, do you mean binutils version 2.31 rather than 2.3.1 ?
Version 2.3.1 would be extremely old...
Yes 2.31
Post by Nick Clifton
source. In this version of binutils, bfd.h seems to require a
configure.h header file.
Again, just to be clear. Do you mean "config.h" rather than "configure.h".
As far as I know there is no header file called "configure.h".
Should be config.h thanks.
Post by Nick Clifton
What information do PACKAGE,> PACKAGE_VERSION and config.h provide
The PACKAGE and PACKAGE_VERSION definitions would normally
be "binutils" and the version of binutils being built.
Thanks.
Post by Nick Clifton
config.h however is much more than that. It contains a whole
series of pre-processor declarations that are set if a particular
feature is present in the build environment. So for example
HAVE_LONG_LONG is defined if the compiler supports the "long long"
type and HAVE_SYS_TIME_H is defined if the <sys/time.h> header file
is available.
https://sourceware.org/bugzilla/show_bug.cgi?id=14072
and would there be any other
mechanisms to provide this information that might be more portable?
The config.h header file is normally generated by running the
configure script at the top level of the binutils sources. This
script is intended to be portable to a very wide variety of systems.
Thanks. It was not clear how to find this.
Post by Nick Clifton
So in essence the answer to your question is no, there is no better
way to provide this information.
Cheers
Nick
Might it be possible to have a more informative error message? For
example, indicating that either config.h file comes from the binutils
configuration (there can be large number of config.h files from other
packages) or that at some point one should define PACKAGE and
PACKAGE_VERSION to be the "binutils" and the binutils version r
Benson Muite
2018-11-29 14:47:41 UTC
Permalink
Post by Benson Muite
Hi Nick,
Thanks for your answers.
Post by Nick Clifton
Hi Benson,
the bfd.h header file when compiling. Have built binutils-2.3.1 from
Just to be clear, do you mean binutils version 2.31 rather than 2.3.1 ?
Version 2.3.1 would be extremely old...
Yes 2.31
Post by Nick Clifton
source. In this version of binutils, bfd.h seems to require a
configure.h header file.
Again, just to be clear. Do you mean "config.h" rather than "configure.h".
As far as I know there is no header file called "configure.h".
Should be config.h thanks.
Post by Nick Clifton
What information do PACKAGE,> PACKAGE_VERSION and config.h provide
The PACKAGE and PACKAGE_VERSION definitions would normally
be "binutils" and the version of binutils being built.
Thanks.
Post by Nick Clifton
config.h however is much more than that. It contains a whole
series of pre-processor declarations that are set if a particular
feature is present in the build environment. So for example
HAVE_LONG_LONG is defined if the compiler supports the "long long"
type and HAVE_SYS_TIME_H is defined if the <sys/time.h> header file
is available.
https://sourceware.org/bugzilla/show_bug.cgi?id=14072
and would there be any other
mechanisms to provide this information that might be more portable?
The config.h header file is normally generated by running the
configure script at the top level of the binutils sources. This
script is intended to be portable to a very wide variety of systems.
Thanks. It was not clear how to find this.
Post by Nick Clifton
So in essence the answer to your question is no, there is no better
way to provide this information.
Cheers
Nick
Might it be possible to have a more informative error message? For
example, indicating that either config.h file comes from the binutils
configuration (there can be large number of config.h files from other
packages) or that at some point one should define PACKAGE and
PACKAGE_VERSION to be the "binutils" and the binutils version respectively?
Regards,
Benson
There are numerous config.h files in binutils, so should be the config.h
in the bfd build subdirectory of the binutils-2.31 build directory, not
binutils subdirectory of binutils-

Loading...