public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Luke <hazelnusse@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: TARGET undefined in bucomm.c
Date: Mon, 06 Jun 2011 18:19:00 -0000	[thread overview]
Message-ID: <BANLkTimmGLx8XTPnoYbjueaQw-CLci5V_g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=FusQUCOCb9qmdV0OpwjZSp8BGcA@mail.gmail.com>

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

  reply	other threads:[~2011-06-06 18:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 17:46 Luke
2011-06-06 17:58 ` H.J. Lu
2011-06-06 18:19   ` Luke [this message]
2011-06-06 19:32     ` Luke
2011-06-06 20:04       ` Ian Lance Taylor
2011-06-07  3:14         ` Luke
2011-06-07 12:11           ` Ian Lance Taylor
2011-06-07 12:24             ` Andreas Schwab
2011-06-07 18:27             ` Luke
2011-06-07 18:58               ` H.J. Lu
2011-06-08  0:41                 ` Luke
2011-06-08  8:03                   ` Andreas Schwab
2011-06-08  8:28                     ` Luke
2011-06-08  9:20                       ` Alan Modra
2011-06-08 10:08                         ` Luke
2011-06-08 11:07                           ` Andreas Schwab
2011-06-08 16:28                             ` Luke
2011-06-08 13:26                           ` Ian Lance Taylor
2011-06-08 16:55                             ` Luke
2011-06-08 18:02                               ` Ian Lance Taylor
2011-06-08 21:59                                 ` Luke
2011-06-08  8:49                     ` Luke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimmGLx8XTPnoYbjueaQw-CLci5V_g@mail.gmail.com \
    --to=hazelnusse@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).