From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16866 invoked by alias); 6 Jun 2011 18:19:42 -0000 Received: (qmail 16857 invoked by uid 22791); 6 Jun 2011 18:19:41 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jun 2011 18:19:27 +0000 Received: by vws4 with SMTP id 4so3870888vws.0 for ; Mon, 06 Jun 2011 11:19:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.100.74 with SMTP id ew10mr7248026vdb.283.1307384365979; Mon, 06 Jun 2011 11:19:25 -0700 (PDT) Received: by 10.52.181.98 with HTTP; Mon, 6 Jun 2011 11:19:25 -0700 (PDT) In-Reply-To: References: Date: Mon, 06 Jun 2011 18:19:00 -0000 Message-ID: Subject: Re: TARGET undefined in bucomm.c From: Luke To: "H.J. Lu" Cc: binutils@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00054.txt.bz2 After unpacking the source tarball, there is only config.in, and it has thi= s: #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=3D"\"/usr/local/share/locale\"" -Dbin_dummy_emulation=3Dbin_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: =E2=80=98TARGET_PREPENDS_UNDERSCORE=E2=80=99 undecl= ared 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=3D"\"/usr/local/share/locale\"" -Dbin_dummy_emulation=3Dbin_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 wrote: > On Mon, Jun 6, 2011 at 10:45 AM, Luke wrote: >> I'm trying to compile binutils-2.21 on x86_64 . =C2=A0I configured using: >> >> $ mkdir build >> $ cd build >> $ ../configure --target=3Darm-none-eabi --enable-multilib --with-gnu-as >> --with-gnu-ld --disable-nls --disable-werror >> >> It gets through the compilation of libiterty, bfd, and opcodes. =C2=A0Th= en, >> when building binutils, it fails as follows: >> >> gcc -DHAVE_CONFIG_H -I. -I../../binutils =C2=A0-I. -I../../binutils >> -I../bfd -I../../binutils/../bfd -I../../binutils/../include >> -DLOCALEDIR=3D"\"/usr/local/share/locale\"" >> -Dbin_dummy_emulation=3Dbin_vanilla_emulation =C2=A0-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 =E2=80=98set_default_bfd_target=E2= =80=99: >> ../../binutils/bucomm.c:160:24: error: =E2=80=98TARGET=E2=80=99 undeclar= ed (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=3D12844 >> >> Searching the internet has been fruitless, has anybody else seen this be= havior? >> >> 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. > --=20 "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