TARGET undefined in bucomm.c

Luke hazelnusse@gmail.com
Mon Jun 6 18:19:00 GMT 2011


After unpacking the source tarball, there is only config.in, and it has this:

#undef TARGET
#undef TARGET_PREPENDS_UNDERSCORE

after running configure as I described, it has the same thing, and
config.h has not been generated at this point.

After running make, and failing, config.h is generated and has this:

#define TARGET "arm-none-eabi"
#define TARGET_PREPENDS_UNDERSCORE 0

bucomm.c does not have a line:
#include "config.h"

When I add that line to bucomm.c, bucomm.o is built, but then it fails
again on cxxfilt.c, which also does not #include "config.h".  Here is
the error I get for that:
gcc -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./../bfd -I./../include
-DLOCALEDIR="\"/usr/local/share/locale\""
-Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 -MT cxxfilt.o
-MD -MP -MF .deps/cxxfilt.Tpo -c -o cxxfilt.o cxxfilt.c
cxxfilt.c:34:31: error: ‘TARGET_PREPENDS_UNDERSCORE’ undeclared here
(not in a function)
make[4]: *** [cxxfilt.o] Error 1

TARGET_PREPENDS_UNDERSCORE is #defined in config.h.  Adding it to
cxxfilt.c lets it compile, but with a warning:
gcc -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./../bfd -I./../include
-DLOCALEDIR="\"/usr/local/share/locale\""
-Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 -MT cxxfilt.o
-MD -MP -MF .deps/cxxfilt.Tpo -c -o cxxfilt.o cxxfilt.c
In file included from cxxfilt.c:32:0:
config.h:157:0: warning: "PACKAGE" redefined
../bfd/config.h:245:0: note: this is the location of the previous definition

and finally binutils finishes compiling, but then gas fails, with
similar errors that would seemingly be fixed if the appropriate files
were pound including config.h

Is there some other way I should be compiling so that these define
statements are inserted correctly, or should these .c files actually
be #including config.h?  Or maybe the config.h needs to be included in
just one top level header file and that would fix all of this?

~Luke

On Mon, Jun 6, 2011 at 10:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jun 6, 2011 at 10:45 AM, Luke <hazelnusse@gmail.com> wrote:
>> I'm trying to compile binutils-2.21 on x86_64 .  I configured using:
>>
>> $ mkdir build
>> $ cd build
>> $ ../configure --target=arm-none-eabi --enable-multilib --with-gnu-as
>> --with-gnu-ld --disable-nls --disable-werror
>>
>> It gets through the compilation of libiterty, bfd, and opcodes.  Then,
>> when building binutils, it fails as follows:
>>
>> gcc -DHAVE_CONFIG_H -I. -I../../binutils  -I. -I../../binutils
>> -I../bfd -I../../binutils/../bfd -I../../binutils/../include
>> -DLOCALEDIR="\"/usr/local/share/locale\""
>> -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall
>> -Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 -MT bucomm.o
>> -MD -MP -MF .deps/bucomm.Tpo -c -o bucomm.o ../../binutils/bucomm.c
>> ../../binutils/bucomm.c: In function ‘set_default_bfd_target’:
>> ../../binutils/bucomm.c:160:24: error: ‘TARGET’ undeclared (first use
>> in this function)
>> ../../binutils/bucomm.c:160:24: note: each undeclared identifier is
>> reported only once for each function it appears in
>>
>> I have grepped all the files for TARGET and don't understand why this
>> would be happening -- am I using configure wrong, or do I need to
>> define an environment variable?
>>
>> I have filed a bug report here:
>> http://sourceware.org/bugzilla/show_bug.cgi?id=12844
>>
>> Searching the internet has been fruitless, has anybody else seen this behavior?
>>
>> Let me know if there is other information I should provide to help
>> figure this out.
>
> Please show
>
> # grep TARGET binutils/config.h
>
> I got
>
> [hjl@gnu-6 build-x86_64-linux]$ grep TARGET binutils/config.h
> #define TARGET "x86_64-unknown-linux-gnu"
> #define TARGET_PREPENDS_UNDERSCORE 0
> [hjl@gnu-6 build-x86_64-linux]$
>
>
> --
> H.J.
>



-- 
"Those who would give up essential liberty to purchase a little
temporary safety deserve neither liberty nor safety."

-- Benjamin Franklin, Historical Review of Pennsylvania, 1759



More information about the Binutils mailing list