[Bug binutils/14243] New: software that includes bfd.h fails to build with "#error config.h must be included before this header"

2012-06-14 Thread maynardj at us dot ibm.com
http://sourceware.org/bugzilla/show_bug.cgi?id=14243

 Bug #: 14243
   Summary: software that includes bfd.h fails to build with
"#error config.h must be included before this header"
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: critical
  Priority: P2
 Component: binutils
AssignedTo: unassig...@sourceware.org
ReportedBy: mayna...@us.ibm.com
Classification: Unclassified


A build of the oprofile package against a June 12, 2012 CVS snapshot of
binutils fails with the following:


make[2]: Entering directory `/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent'
/bin/sh ../libtool --tag=CC   --mode=compile /opt/at5.0-5-rc1/bin/gcc
-DHAVE_CONFIG_H -I. -I.. -I/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent   
-fPIC -I /home/cseo/at5.0/at5.0-5/src/oprofile/libop -I
/home/cseo/at5.0/at5.0-5/src/oprofile/libutil -g -MT libopagent_la-opagent.lo
-MD -MP -MF .deps/libopagent_la-opagent.Tpo -c -o libopagent_la-opagent.lo
`test -f 'opagent.c' || echo
'/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent/'`opagent.c
libtool: compile:  /opt/at5.0-5-rc1/bin/gcc -DHAVE_CONFIG_H -I. -I..
-I/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent -fPIC -I
/home/cseo/at5.0/at5.0-5/src/oprofile/libop -I
/home/cseo/at5.0/at5.0-5/src/oprofile/libutil -g -MT libopagent_la-opagent.lo
-MD -MP -MF .deps/libopagent_la-opagent.Tpo -c opagent.c  -fPIC -DPIC -o
.libs/libopagent_la-opagent.o
In file included from opagent.c:63:0:
/opt/at5.0-5-rc1/include/bfd.h:37:2: error: #error config.h must be included
before this header
make[2]: Entering directory `/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent'
/bin/sh ../libtool --tag=CC   --mode=compile /opt/at5.0-5-rc1/bin/gcc
-DHAVE_CONFIG_H -I. -I.. -I/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent   
-fPIC -I /home/cseo/at5.0/at5.0-5/src/oprofile/libop -I
/home/cseo/at5.0/at5.0-5/src/oprofile/libutil -g -MT libopagent_la-opagent.lo
-MD -MP -MF .deps/libopagent_la-opagent.Tpo -c -o libopagent_la-opagent.lo
`test -f 'opagent.c' || echo
'/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent/'`opagent.c
libtool: compile:  /opt/at5.0-5-rc1/bin/gcc -DHAVE_CONFIG_H -I. -I..
-I/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent -fPIC -I
/home/cseo/at5.0/at5.0-5/src/oprofile/libop -I
/home/cseo/at5.0/at5.0-5/src/oprofile/libutil -g -MT libopagent_la-opagent.lo
-MD -MP -MF .deps/libopagent_la-opagent.Tpo -c opagent.c  -fPIC -DPIC -o
.libs/libopagent_la-opagent.o
In file included from opagent.c:63:0:
/opt/at5.0-5-rc1/include/bfd.h:37:2: error: #error config.h must be included
before this header


This failure is apparently related to the binutils change that went in via bug
# 14072.  This change apparently enforces that any file that includes "bfd.h"
also includes "config.h".  As I understand it, this change was intended for
binutils source files only since the "config.h" file being required is
binutils' config.h.  Yet the change is improperly requiring external software
to also include a "config.h" before including bfd.h.  For the case in question,
oprofile's opagent.c does not include the oprofile's config.h and does not
require it.  While we *could* hack opagent.c (and several other oprofile files
that include bfd.h) to unnecessarily include oprofile's config.h, this seems to
be the wrong fix to this problem.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/14243] software that includes bfd.h fails to build with "#error config.h must be included before this header"

2012-06-15 Thread maynardj at us dot ibm.com
http://sourceware.org/bugzilla/show_bug.cgi?id=14243

--- Comment #4 from Maynard Johnson  2012-06-15 
15:15:56 UTC ---
(In reply to comment #2)
> A further comment.  I see HAVE_STRINGIZE is obsolescent according to the
> autoconf docs.  So my argument for config.h being included before the current
> version of bfd.h isn't really that strong.  However, it is a really good idea
> to always include config.h (or sysdep.h or alloca-conf.h that include 
> config.h)
> before any other files, including system headers.  See bug #13558.
> 
> Beside all that, I can't see the binutils project reverting this change.  Yes,
> it causes some initial pain (and I grumbled about the change myself), but
> overall the change is a good one.  If you (oprofile project) want to insulate
> yourself from a change like this one, then you really should be distributing
> your own copy of bfd along with oprofile sources.  That would allow you to
> resolve these issues at your leisure.

OK, I'll post patches to the oprofile list to comply with this requirement. 
You can close this bug report. Thanks.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils