* TARGET undefined in bucomm.c @ 2011-06-06 17:46 Luke 2011-06-06 17:58 ` H.J. Lu 0 siblings, 1 reply; 22+ messages in thread From: Luke @ 2011-06-06 17:46 UTC (permalink / raw) To: binutils 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. Thanks, ~Luke ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-06 17:46 TARGET undefined in bucomm.c Luke @ 2011-06-06 17:58 ` H.J. Lu 2011-06-06 18:19 ` Luke 0 siblings, 1 reply; 22+ messages in thread From: H.J. Lu @ 2011-06-06 17:58 UTC (permalink / raw) To: Luke; +Cc: binutils 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. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-06 17:58 ` H.J. Lu @ 2011-06-06 18:19 ` Luke 2011-06-06 19:32 ` Luke 0 siblings, 1 reply; 22+ messages in thread From: Luke @ 2011-06-06 18:19 UTC (permalink / raw) To: H.J. Lu; +Cc: binutils 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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-06 18:19 ` Luke @ 2011-06-06 19:32 ` Luke 2011-06-06 20:04 ` Ian Lance Taylor 0 siblings, 1 reply; 22+ messages in thread From: Luke @ 2011-06-06 19:32 UTC (permalink / raw) To: H.J. Lu; +Cc: binutils Upon further inspection, it looks like: -- in libiberty nearly every .c file has #include "config.h" or #include <config.h> -- in bfd nearly every .c file has #include sysdep.h, which in turn has #include "config.h" -- in gas, nearly every .c file has #include "as.h", which in turn #includes "config.h" In contrast, in binutils, only these three files #include "config.h": elfedit.c readelf.c syslex.c In my build case, at least bucomm.c and cxxfilt.c needed some things that were defined in config.h. I don't think me just throwing #define "config.h" statements into other peoples source constitutes a proper bugfix, but I don't see how else this can be fixed. How is target getting defined in bucomm.c when other people build it? I tried configure with no options, and this still gives the same error, so it seems there is something about my system that is maybe causing configure to generate a makefile which doesn't properly define TARGET in bucomm.c and TARGET_PREPENDS_UNDERSCORE in cxxfilt.c. It really seems like that this needs to be taken care of, either by adjusting the source to correctly #include things, or adjusting the build to properly #define things in the compiler flags. I'm not a computer scientist, nor do I really have any clue of how binutils is designed, organized or built, but I can see that there is a problem here. What is the right approach to fixing this? ~Luke On Mon, Jun 6, 2011 at 11:19 AM, Luke <hazelnusse@gmail.com> wrote: > 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 > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-06 19:32 ` Luke @ 2011-06-06 20:04 ` Ian Lance Taylor 2011-06-07 3:14 ` Luke 0 siblings, 1 reply; 22+ messages in thread From: Ian Lance Taylor @ 2011-06-06 20:04 UTC (permalink / raw) To: Luke; +Cc: H.J. Lu, binutils Luke <hazelnusse@gmail.com> writes: > In contrast, in binutils, only these three files #include "config.h": > elfedit.c > readelf.c > syslex.c In the binutils sysdep.h includes alloca-conf.h which includes config.h. Why is that not working for you? Ian ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-06 20:04 ` Ian Lance Taylor @ 2011-06-07 3:14 ` Luke 2011-06-07 12:11 ` Ian Lance Taylor 0 siblings, 1 reply; 22+ messages in thread From: Luke @ 2011-06-07 3:14 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: H.J. Lu, binutils Ian, I don't know why it isn't working. What you state is correct, but for some reason, TARGET is not defined in bucomm.c when it attempts to compile it. Again, here is the error message: make[4]: Entering directory `/home/luke/repos/summon-arm-toolchain/binutils-2.21/build/binutils' 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 tried putting a #warning into build/binutils/config.h, and the warning is printed when compiling other files in binutils, specifically syslex.c. However, no warning is echoed when bucomm.c is compiled, indicating to me that this config.h is not being included, but perhaps another one is? I put this into build/binutils/config.h: #warning "build/binutils/config.h is included" this warning is echoed when building syslex: make[2]: Entering directory `/home/luke/repos/summon-arm-toolchain/binutils-2.21/build/binutils' if [ -r sysinfo.c ]; then \ gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 sysinfo.c ; \ else \ gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 ../../binutils/sysinfo.c ; \ fi if [ -r syslex.c ]; then \ gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 syslex.c ; \ else \ gcc -c -I. -I../../binutils -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 ../../binutils/syslex.c ;\ fi In file included from syslex.l:23:0: ./config.h:16:2: warning: #warning "build/binutils/config.h is included" gcc -g -O2 -o sysinfo sysinfo.o syslex.o but not when building bucomm.c. So config.h *isn't* being included, for some reason. I don't know which config.h is being included by alloca-conf.h, but it isn't the generated binutils/config.h. The only major difference I can see is the -I flags. Could this have something to do with it? ~Luke On Mon, Jun 6, 2011 at 1:04 PM, Ian Lance Taylor <iant@google.com> wrote: > Luke <hazelnusse@gmail.com> writes: > >> In contrast, in binutils, only these three files #include "config.h": >> elfedit.c >> readelf.c >> syslex.c > > In the binutils sysdep.h includes alloca-conf.h which includes config.h. > > Why is that not working for you? > > Ian > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 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 0 siblings, 2 replies; 22+ messages in thread From: Ian Lance Taylor @ 2011-06-07 12:11 UTC (permalink / raw) To: Luke; +Cc: H.J. Lu, binutils Luke <hazelnusse@gmail.com> writes: > but not when building bucomm.c. So config.h *isn't* being included, > for some reason. I don't know which config.h is being included by > alloca-conf.h, but it isn't the generated binutils/config.h. The only > major difference I can see is the -I flags. Could this have something > to do with it? Run something like make CFLAGS="-g -O2 --save-temps" bucomm.o That will create, besides bucomm.o, a file bucomm.i. In the first 20 lines of bucomm.i you should see an entry for config.h. Where is config.h being found? When I try it, I see the appended, which shows config.h being included from the binutils build directory, as expected. Ian # 1 "../../src/binutils/bucomm.c" # 1 "/home/iant/binutils/objdir/binutils//" # 1 "<built-in>" # 1 "<command-line>" # 1 "../../src/binutils/bucomm.c" # 26 "../../src/binutils/bucomm.c" # 1 "../../src/binutils/sysdep.h" 1 # 25 "../../src/binutils/sysdep.h" # 1 "../../src/binutils/../include/alloca-conf.h" 1 # 1 "./config.h" 1 # 2 "../../src/binutils/../include/alloca-conf.h" 2 # 1 "/usr/include/alloca.h" 1 3 4 # 22 "/usr/include/alloca.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-07 12:11 ` Ian Lance Taylor @ 2011-06-07 12:24 ` Andreas Schwab 2011-06-07 18:27 ` Luke 1 sibling, 0 replies; 22+ messages in thread From: Andreas Schwab @ 2011-06-07 12:24 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: Luke, H.J. Lu, binutils Ian Lance Taylor <iant@google.com> writes: > Run something like > > make CFLAGS="-g -O2 --save-temps" bucomm.o Or -H. Andreas. -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 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 1 sibling, 1 reply; 22+ messages in thread From: Luke @ 2011-06-07 18:27 UTC (permalink / raw) To: binutils Here are the first lines of bucomm.i: # 1 "../../binutils/bucomm.c" # 1 "/home/luke/repos/summon-arm-toolchain/binutils-2.21/build/binutils//" # 1 "<built-in>" # 1 "<command-line>" # 1 "../../binutils/bucomm.c" # 26 "../../binutils/bucomm.c" # 1 "../../binutils/sysdep.h" 1 # 25 "../../binutils/sysdep.h" # 1 "../../binutils/../include/alloca-conf.h" 1 # 1 "../bfd/config.h" 1 # 2 "../../binutils/../include/alloca-conf.h" 2 # 1 "/usr/include/alloca.h" 1 3 4 # 22 "/usr/include/alloca.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 So, for some reason, it is finding config.h in the bfd folder. What should I do to fix this? ~Luke On Mon, Jun 6, 2011 at 10:13 PM, Ian Lance Taylor <iant@google.com> wrote: > Luke <hazelnusse@gmail.com> writes: > >> but not when building bucomm.c. So config.h *isn't* being included, >> for some reason. I don't know which config.h is being included by >> alloca-conf.h, but it isn't the generated binutils/config.h. The only >> major difference I can see is the -I flags. Could this have something >> to do with it? > > Run something like > > make CFLAGS="-g -O2 --save-temps" bucomm.o > > That will create, besides bucomm.o, a file bucomm.i. In the first 20 > lines of bucomm.i you should see an entry for config.h. Where is > config.h being found? > > When I try it, I see the appended, which shows config.h being included > from the binutils build directory, as expected. > > Ian > > # 1 "../../src/binutils/bucomm.c" > # 1 "/home/iant/binutils/objdir/binutils//" > # 1 "<built-in>" > # 1 "<command-line>" > # 1 "../../src/binutils/bucomm.c" > # 26 "../../src/binutils/bucomm.c" > # 1 "../../src/binutils/sysdep.h" 1 > # 25 "../../src/binutils/sysdep.h" > # 1 "../../src/binutils/../include/alloca-conf.h" 1 > # 1 "./config.h" 1 > # 2 "../../src/binutils/../include/alloca-conf.h" 2 > > > > > > > # 1 "/usr/include/alloca.h" 1 3 4 > # 22 "/usr/include/alloca.h" 3 4 > # 1 "/usr/include/features.h" 1 3 4 > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-07 18:27 ` Luke @ 2011-06-07 18:58 ` H.J. Lu 2011-06-08 0:41 ` Luke 0 siblings, 1 reply; 22+ messages in thread From: H.J. Lu @ 2011-06-07 18:58 UTC (permalink / raw) To: Luke; +Cc: binutils On Tue, Jun 7, 2011 at 11:26 AM, Luke <hazelnusse@gmail.com> wrote: > Here are the first lines of bucomm.i: > > # 1 "../../binutils/bucomm.c" > # 1 "/home/luke/repos/summon-arm-toolchain/binutils-2.21/build/binutils//" > # 1 "<built-in>" > # 1 "<command-line>" > # 1 "../../binutils/bucomm.c" > # 26 "../../binutils/bucomm.c" > # 1 "../../binutils/sysdep.h" 1 > # 25 "../../binutils/sysdep.h" > # 1 "../../binutils/../include/alloca-conf.h" 1 > # 1 "../bfd/config.h" 1 > # 2 "../../binutils/../include/alloca-conf.h" 2 > > > # 1 "/usr/include/alloca.h" 1 3 4 > # 22 "/usr/include/alloca.h" 3 4 > # 1 "/usr/include/features.h" 1 3 4 > > So, for some reason, it is finding config.h in the bfd folder. > > What should I do to fix this? > Don't put build directory inside binutils source tree. H.J. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-07 18:58 ` H.J. Lu @ 2011-06-08 0:41 ` Luke 2011-06-08 8:03 ` Andreas Schwab 0 siblings, 1 reply; 22+ messages in thread From: Luke @ 2011-06-08 0:41 UTC (permalink / raw) To: H.J. Lu; +Cc: binutils I tried three approaches, all which led to the same error: First, a build folder outside of the source tree: $ tar xvf binutils-2.21.tar.bz2 $ mkdir build $ cd build $ ../binutils-2.21/configure $ make and I get: make[4]: Entering directory `/home/luke/repos/summon-arm-toolchain/build/binutils' gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.21/binutils -I. -I../../binutils-2.21/binutils -I../bfd -I../../binutils-2.21/binutils/../bfd -I../../binutils-2.21/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-2.21/binutils/bucomm.c ../../binutils-2.21/binutils/bucomm.c: In function ‘set_default_bfd_target’: ../../binutils-2.21/binutils/bucomm.c:160:24: error: ‘TARGET’ undeclared (first use in this function) ../../binutils-2.21/binutils/bucomm.c:160:24: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [bucomm.o] Error 1 Second, I tried a build in the source tree: $ tar xvf binutils-2.21.tar.bz2 $ cd binutils-2.21 $ ./configure $ make and I get: make[4]: Entering directory `/home/luke/repos/summon-arm-toolchain/binutils-2.21/binutils' 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 size.o -MD -MP -MF .deps/size.Tpo -c -o size.o size.c mv -f .deps/size.Tpo .deps/size.Po 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 bucomm.o -MD -MP -MF .deps/bucomm.Tpo -c -o bucomm.o bucomm.c bucomm.c: In function ‘set_default_bfd_target’: bucomm.c:160:24: error: ‘TARGET’ undeclared (first use in this function) bucomm.c:160:24: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [bucomm.o] Error 1 Finally, if I make a build folder inside of the source tree, I get the same exact result, which is what I reported previously. So this doesn't seem to be the source of the problem. ~Luke On Tue, Jun 7, 2011 at 11:58 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Tue, Jun 7, 2011 at 11:26 AM, Luke <hazelnusse@gmail.com> wrote: >> Here are the first lines of bucomm.i: >> >> # 1 "../../binutils/bucomm.c" >> # 1 "/home/luke/repos/summon-arm-toolchain/binutils-2.21/build/binutils//" >> # 1 "<built-in>" >> # 1 "<command-line>" >> # 1 "../../binutils/bucomm.c" >> # 26 "../../binutils/bucomm.c" >> # 1 "../../binutils/sysdep.h" 1 >> # 25 "../../binutils/sysdep.h" >> # 1 "../../binutils/../include/alloca-conf.h" 1 >> # 1 "../bfd/config.h" 1 >> # 2 "../../binutils/../include/alloca-conf.h" 2 >> >> >> # 1 "/usr/include/alloca.h" 1 3 4 >> # 22 "/usr/include/alloca.h" 3 4 >> # 1 "/usr/include/features.h" 1 3 4 >> >> So, for some reason, it is finding config.h in the bfd folder. >> >> What should I do to fix this? >> > > Don't put build directory inside binutils source tree. > > > 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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 0:41 ` Luke @ 2011-06-08 8:03 ` Andreas Schwab 2011-06-08 8:28 ` Luke 2011-06-08 8:49 ` Luke 0 siblings, 2 replies; 22+ messages in thread From: Andreas Schwab @ 2011-06-08 8:03 UTC (permalink / raw) To: Luke; +Cc: H.J. Lu, binutils Luke <hazelnusse@gmail.com> writes: > I tried three approaches, all which led to the same error: Do you have any config.h in the source? Andreas. -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 8:03 ` Andreas Schwab @ 2011-06-08 8:28 ` Luke 2011-06-08 9:20 ` Alan Modra 2011-06-08 8:49 ` Luke 1 sibling, 1 reply; 22+ messages in thread From: Luke @ 2011-06-08 8:28 UTC (permalink / raw) Cc: H.J. Lu, binutils Yes. In the build folder (next to the source folder) there are these: $ find build -name "config.h" ./binutils/config.h ./opcodes/config.h ./libiberty/config.h ./intl/config.h ./bfd/config.h the bucomm.o target is including finding bfg/config.h, instead of binutils/config.h: # 1 "../../binutils-2.21/binutils/bucomm.c" # 1 "/home/luke/repos/summon-arm-toolchain/build/binutils//" # 1 "<built-in>" # 1 "<command-line>" # 1 "../../binutils-2.21/binutils/bucomm.c" # 26 "../../binutils-2.21/binutils/bucomm.c" # 1 "../../binutils-2.21/binutils/sysdep.h" 1 # 25 "../../binutils-2.21/binutils/sysdep.h" # 1 "../../binutils-2.21/binutils/../include/alloca-conf.h" 1 # 1 "../bfd/config.h" 1 # 2 "../../binutils-2.21/binutils/../include/alloca-conf.h" 2 I don't know why that is, but I think it must be the reason TARGETS is undefined. ~Luke On Wed, Jun 8, 2011 at 1:03 AM, Andreas Schwab <schwab@redhat.com> wrote: > Luke <hazelnusse@gmail.com> writes: > >> I tried three approaches, all which led to the same error: > > Do you have any config.h in the source? > > Andreas. > > -- > Andreas Schwab, schwab@redhat.com > GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E > "And now for something completely different." > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 8:28 ` Luke @ 2011-06-08 9:20 ` Alan Modra 2011-06-08 10:08 ` Luke 0 siblings, 1 reply; 22+ messages in thread From: Alan Modra @ 2011-06-08 9:20 UTC (permalink / raw) To: Luke; +Cc: binutils On Wed, Jun 08, 2011 at 01:28:08AM -0700, Luke wrote: > Yes. In the build folder (next to the source folder) there are these: > $ find build -name "config.h" > ./binutils/config.h > ./opcodes/config.h > ./libiberty/config.h > ./intl/config.h > ./bfd/config.h > > the bucomm.o target is including finding bfg/config.h, instead of > binutils/config.h: > # 1 "../../binutils-2.21/binutils/bucomm.c" > # 1 "/home/luke/repos/summon-arm-toolchain/build/binutils//" > # 1 "<built-in>" > # 1 "<command-line>" > # 1 "../../binutils-2.21/binutils/bucomm.c" > # 26 "../../binutils-2.21/binutils/bucomm.c" > # 1 "../../binutils-2.21/binutils/sysdep.h" 1 > # 25 "../../binutils-2.21/binutils/sysdep.h" > # 1 "../../binutils-2.21/binutils/../include/alloca-conf.h" 1 > # 1 "../bfd/config.h" 1 > # 2 "../../binutils-2.21/binutils/../include/alloca-conf.h" 2 > > I don't know why that is, but I think it must be the reason TARGETS is > undefined. Unless you have been editing include/alloca-conf.h, I'd say you have a broken gcc. The first line of alloca-conf.h is #include "config.h" There isn't a config.h in source_path/include/, so gcc should start looking in the -I paths you showed on your gcc command line. The first one was "." and you're in build_path/binutils/ when compiling bucomm.c, so gcc should pick up the config.h in that dir. (Adding -v to the gcc command line will verify the search paths.) config.h is readable isn't it? -- Alan Modra Australia Development Lab, IBM ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 9:20 ` Alan Modra @ 2011-06-08 10:08 ` Luke 2011-06-08 11:07 ` Andreas Schwab 2011-06-08 13:26 ` Ian Lance Taylor 0 siblings, 2 replies; 22+ messages in thread From: Luke @ 2011-06-08 10:08 UTC (permalink / raw) To: Luke, binutils The gcc I am using is what came with Kubuntu 11.04: luke@ThinkPad-W510:binutils$ gcc --version -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) COLLECT_GCC_OPTIONS='-fversion' '-v' '-mtune=generic' '-march=x86-64' /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1 -quiet -v help-dummy -D_FORTIFY_SOURCE=2 -quiet -dumpbase help-dummy -mtune=generic -march=x86-64 -auxbase help-dummy -version -fversion -fstack-protector -o /tmp/cc24ZqNP.s GNU C (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu) compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='-fversion' '-v' '-mtune=generic' '-march=x86-64' as -V -Qy --64 --version -o /tmp/ccyZVzzN.o /tmp/cc24ZqNP.s GNU assembler version 2.21.0 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.21.0.20110327 GNU assembler (GNU Binutils for Ubuntu) 2.21.0.20110327 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-linux-gnu'. COMPILER_PATH=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/home/luke/usr/lib/:./:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/:/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../:/lib/:/usr/lib/:/usr/lib/x86_64-linux-gnu/ COLLECT_GCC_OPTIONS='-fversion' '-v' '-mtune=generic' '-march=x86-64' /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/collect2 --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro --version /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crt1.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crti.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtbegin.o -L/home/luke/usr/lib -L. -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2 -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccyZVzzN.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtend.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crtn.o GNU ld (GNU Binutils for Ubuntu) 2.21.0.20110327 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. luke@ThinkPad-W510:binutils$ When I run command given by make, but with the -v option as you suggest, I get: GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/include" ignoring duplicate directory "." as it is a non-system directory that duplicates a system directory ignoring duplicate directory "." as it is a non-system directory that duplicates a system directory ignoring duplicate directory "../../binutils-2.21/binutils" #include "..." search starts here: #include <...> search starts here: ../../binutils-2.21/binutils ../bfd ../../binutils-2.21/binutils/../bfd ../../binutils-2.21/binutils/../include /home/luke/usr/include . /usr/local/include /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. I just did a clean install of Ubuntu 11.04 on a virtual machine and it compiled just fine out of the box. My host machine is Kubuntu 11.04 and gcc is the same version and seems to be built with the same flags, so it would be weird if those two things were the same yet gcc was somehow to blame. Maybe something else with my build environment is messing things up? ~Luke On Wed, Jun 8, 2011 at 2:19 AM, Alan Modra <amodra@gmail.com> wrote: > On Wed, Jun 08, 2011 at 01:28:08AM -0700, Luke wrote: >> Yes. In the build folder (next to the source folder) there are these: >> $ find build -name "config.h" >> ./binutils/config.h >> ./opcodes/config.h >> ./libiberty/config.h >> ./intl/config.h >> ./bfd/config.h >> >> the bucomm.o target is including finding bfg/config.h, instead of >> binutils/config.h: >> # 1 "../../binutils-2.21/binutils/bucomm.c" >> # 1 "/home/luke/repos/summon-arm-toolchain/build/binutils//" >> # 1 "<built-in>" >> # 1 "<command-line>" >> # 1 "../../binutils-2.21/binutils/bucomm.c" >> # 26 "../../binutils-2.21/binutils/bucomm.c" >> # 1 "../../binutils-2.21/binutils/sysdep.h" 1 >> # 25 "../../binutils-2.21/binutils/sysdep.h" >> # 1 "../../binutils-2.21/binutils/../include/alloca-conf.h" 1 >> # 1 "../bfd/config.h" 1 >> # 2 "../../binutils-2.21/binutils/../include/alloca-conf.h" 2 >> >> I don't know why that is, but I think it must be the reason TARGETS is >> undefined. > > Unless you have been editing include/alloca-conf.h, I'd say you have a > broken gcc. The first line of alloca-conf.h is > #include "config.h" > > There isn't a config.h in source_path/include/, so gcc should start > looking in the -I paths you showed on your gcc command line. The > first one was "." and you're in build_path/binutils/ when compiling > bucomm.c, so gcc should pick up the config.h in that dir. (Adding -v > to the gcc command line will verify the search paths.) config.h is > readable isn't it? > > -- > Alan Modra > Australia Development Lab, IBM > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 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 1 sibling, 1 reply; 22+ messages in thread From: Andreas Schwab @ 2011-06-08 11:07 UTC (permalink / raw) To: Luke; +Cc: binutils Luke <hazelnusse@gmail.com> writes: > ignoring duplicate directory "." > as it is a non-system directory that duplicates a system directory > ignoring duplicate directory "." > as it is a non-system directory that duplicates a system directory > ignoring duplicate directory "../../binutils-2.21/binutils" > #include "..." search starts here: > #include <...> search starts here: > ../../binutils-2.21/binutils > ../bfd > ../../binutils-2.21/binutils/../bfd > ../../binutils-2.21/binutils/../include > /home/luke/usr/include > . Your compiler is definitely broken. Andreas. -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 11:07 ` Andreas Schwab @ 2011-06-08 16:28 ` Luke 0 siblings, 0 replies; 22+ messages in thread From: Luke @ 2011-06-08 16:28 UTC (permalink / raw) To: Andreas Schwab; +Cc: binutils The same compiler, complied with the same configure flags, builds binutils on the same version of Ubuntu (11.04) installed on a virtual machine without these errors. On Wed, Jun 8, 2011 at 4:06 AM, Andreas Schwab <schwab@redhat.com> wrote: > Luke <hazelnusse@gmail.com> writes: > >> ignoring duplicate directory "." >> as it is a non-system directory that duplicates a system directory >> ignoring duplicate directory "." >> as it is a non-system directory that duplicates a system directory >> ignoring duplicate directory "../../binutils-2.21/binutils" >> #include "..." search starts here: >> #include <...> search starts here: >> ../../binutils-2.21/binutils >> ../bfd >> ../../binutils-2.21/binutils/../bfd >> ../../binutils-2.21/binutils/../include >> /home/luke/usr/include >> . > > Your compiler is definitely broken. > > Andreas. > > -- > Andreas Schwab, schwab@redhat.com > GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E > "And now for something completely different." > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 10:08 ` Luke 2011-06-08 11:07 ` Andreas Schwab @ 2011-06-08 13:26 ` Ian Lance Taylor 2011-06-08 16:55 ` Luke 1 sibling, 1 reply; 22+ messages in thread From: Ian Lance Taylor @ 2011-06-08 13:26 UTC (permalink / raw) To: Luke; +Cc: binutils Luke <hazelnusse@gmail.com> writes: > When I run command given by make, but with the -v option as you suggest, I get: > GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 > ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" > ignoring nonexistent directory > "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/include" > ignoring duplicate directory "." > as it is a non-system directory that duplicates a system directory > ignoring duplicate directory "." > as it is a non-system directory that duplicates a system directory > ignoring duplicate directory "../../binutils-2.21/binutils" > #include "..." search starts here: > #include <...> search starts here: > ../../binutils-2.21/binutils > ../bfd > ../../binutils-2.21/binutils/../bfd > ../../binutils-2.21/binutils/../include > /home/luke/usr/include > . > /usr/local/include > /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include > /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include-fixed > /usr/include/x86_64-linux-gnu > /usr/include > End of search list. You didn't show the command here. Did it have -I. first, as it should? If so, I don't see how that #include search path is possible. And what is /home/luke/usr/include doing on the search path? Do you have CPATH or C_INCLUDE_PATH set in the environment? Ian ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 13:26 ` Ian Lance Taylor @ 2011-06-08 16:55 ` Luke 2011-06-08 18:02 ` Ian Lance Taylor 0 siblings, 1 reply; 22+ messages in thread From: Luke @ 2011-06-08 16:55 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: binutils > You didn't show the command here. Did it have -I. first, as it should? > If so, I don't see how that #include search path is possible. And what > is /home/luke/usr/include doing on the search path? Do you have CPATH > or C_INCLUDE_PATH set in the environment? > > Ian > Here is the command, along with the output: luke@ThinkPad-W510:binutils-2.21-build$ cd binutils/ luke@ThinkPad-W510:binutils$ gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.21/binutils -I. -I../../binutils-2.21/binutils -I../bfd -I../../binutils-2.21/binutils/../bfd -I../../binutils-2.21/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-2.21/binutils/bucomm.c -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) COLLECT_GCC_OPTIONS='-DHAVE_CONFIG_H' '-I.' '-I../../binutils-2.21/binutils' '-I.' '-I../../binutils-2.21/binutils' '-I../bfd' '-I../../binutils-2.21/binutils/../bfd' '-I../../binutils-2.21/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' '-v' '-mtune=generic' '-march=x86-64' /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1 -quiet -v -I. -I../../binutils-2.21/binutils -I. -I../../binutils-2.21/binutils -I../bfd -I../../binutils-2.21/binutils/../bfd -I../../binutils-2.21/binutils/../include -MD bucomm.d -MF .deps/bucomm.Tpo -MP -MT bucomm.o -DHAVE_CONFIG_H -DLOCALEDIR="/usr/local/share/locale" -Dbin_dummy_emulation=bin_vanilla_emulation ../../binutils-2.21/binutils/bucomm.c -D_FORTIFY_SOURCE=2 -quiet -dumpbase bucomm.c -mtune=generic -march=x86-64 -auxbase-strip bucomm.o -g -O2 -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -version -fstack-protector -o /tmp/cc9giKCY.s GNU C (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu) compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../../../x86_64-linux-gnu/include" ignoring duplicate directory "." as it is a non-system directory that duplicates a system directory ignoring duplicate directory "." as it is a non-system directory that duplicates a system directory ignoring duplicate directory "../../binutils-2.21/binutils" #include "..." search starts here: #include <...> search starts here: ../../binutils-2.21/binutils ../bfd ../../binutils-2.21/binutils/../bfd ../../binutils-2.21/binutils/../include /home/luke/usr/include . /usr/local/include /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. GNU C (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu) compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 9755ab75799195519479ef699703b13b ../../binutils-2.21/binutils/bucomm.c: In function ‘set_default_bfd_target’: ../../binutils-2.21/binutils/bucomm.c:160:24: error: ‘TARGET’ undeclared (first use in this function) ../../binutils-2.21/binutils/bucomm.c:160:24: note: each undeclared identifier is reported only once for each function it appears in luke@ThinkPad-W510:binutils$ CPATH is not defined as an environment variable. C_INCLUDE_PATH is and has one directory entry: /home/luke/usr/include. Unsetting C_INCLUDE_PATH fixed the problem. That folder did not have much in it, I don't think any of the headers in there would have been included, but I could be wrong. Here are the contents of that folder: luke@ThinkPad-W510:include$ pwd /home/luke/usr/include luke@ThinkPad-W510:include$ ls ecpg_config.h libpq-events.h pgtypes_error.h sqlca.h ecpgerrno.h libpq-fe.h pgtypes_interval.h sqlda-compat.h ecpg_informix.h libusb-1.0 pgtypes_numeric.h sqlda.h ecpglib.h pg_config.h pgtypes_timestamp.h sqlda-native.h ecpgtype.h pg_config_manual.h postgres_ext.h vtk-5.9 libftdi pg_config_os.h postgresql libpq pgtypes_date.h sql3types.h luke@ThinkPad-W510:include$ As a quick test, I moved the contents of that directory elsewhere, so it was empty, and then reconfigured and ran make. The same build error comes back. So it seems that the contents of that folder are not the problem, but rather the way the environment variable is defined. Here is my relevant .bashrc: # Path to search for C include files export C_INCLUDE_PATH=$HOME/usr/include:$C_INCLUDE_PATH and this is what it is set to immediately prior to the configure and make steps: $ echo $C_INCLUDE_PATH /home/luke/usr/include: The colon at the end of C_INCLUDE_PATH seemed fishy to me, so I redefined it without the colon: $ export $C_INCLUDE_PATH=/home/luke/usr/include And this fixes everything, even when /home/luke/usr/include has all of the headers that I had installed there. So, am I correct in understanding that C_INCLUDE_PATH should not have a trailing colon, and if it does, it may wreak havoc on things in non-obvious ways? Might this be a bug in how gcc (or some other part of the build process) parses the environment variables? It would be nice understand why this happened, because even though I am able to get binutils to build, I have no idea why, and the errors I got were far from informative. ~Luke ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 16:55 ` Luke @ 2011-06-08 18:02 ` Ian Lance Taylor 2011-06-08 21:59 ` Luke 0 siblings, 1 reply; 22+ messages in thread From: Ian Lance Taylor @ 2011-06-08 18:02 UTC (permalink / raw) To: Luke; +Cc: binutils Luke <hazelnusse@gmail.com> writes: > So, am I correct in understanding that C_INCLUDE_PATH should not have > a trailing colon, and if it does, it may wreak havoc on things in > non-obvious ways? Might this be a bug in how gcc (or some other part > of the build process) parses the environment variables? In any PATH variable, a trailing (or leading) colon means the current directory (i.e., "."). In this case it was breaking things because it meant that the explicit -I. command line option was being discarded as a duplicate, and so "." was being searched at the wrong point in the search path. Ian ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 18:02 ` Ian Lance Taylor @ 2011-06-08 21:59 ` Luke 0 siblings, 0 replies; 22+ messages in thread From: Luke @ 2011-06-08 21:59 UTC (permalink / raw) To: Ian Lance Taylor; +Cc: binutils Ok this makes sense now. Thank you for helping me figure this out. ~Luke On Wed, Jun 8, 2011 at 11:01 AM, Ian Lance Taylor <iant@google.com> wrote: > Luke <hazelnusse@gmail.com> writes: > >> So, am I correct in understanding that C_INCLUDE_PATH should not have >> a trailing colon, and if it does, it may wreak havoc on things in >> non-obvious ways? Might this be a bug in how gcc (or some other part >> of the build process) parses the environment variables? > > In any PATH variable, a trailing (or leading) colon means the current > directory (i.e., "."). In this case it was breaking things because it > meant that the explicit -I. command line option was being discarded as a > duplicate, and so "." was being searched at the wrong point in the > search path. > > Ian > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: TARGET undefined in bucomm.c 2011-06-08 8:03 ` Andreas Schwab 2011-06-08 8:28 ` Luke @ 2011-06-08 8:49 ` Luke 1 sibling, 0 replies; 22+ messages in thread From: Luke @ 2011-06-08 8:49 UTC (permalink / raw) Cc: H.J. Lu, binutils I think all the config.h files are generated, so the source folder doesn't have any: luke@ThinkPad-W510:summon-arm-toolchain(master)$ find binutils-2.21/ -name "config.h" luke@ThinkPad-W510:summon-arm-toolchain(master)$ find binutils-2.21/ -name "config.*" binutils-2.21/config.sub binutils-2.21/binutils/config.in binutils-2.21/config.rpath binutils-2.21/opcodes/config.in binutils-2.21/gas/config.in binutils-2.21/libiberty/config.h-vms binutils-2.21/libiberty/config.in binutils-2.21/intl/config.intl.in binutils-2.21/intl/config.h.in binutils-2.21/gold/config.in binutils-2.21/bfd/config.bfd binutils-2.21/bfd/config.in binutils-2.21/gprof/config.texi binutils-2.21/ld/config.in binutils-2.21/config.guess Is that what you meant? ~Luke On Wed, Jun 8, 2011 at 1:03 AM, Andreas Schwab <schwab@redhat.com> wrote: > Luke <hazelnusse@gmail.com> writes: > >> I tried three approaches, all which led to the same error: > > Do you have any config.h in the source? > > Andreas. > > -- > Andreas Schwab, schwab@redhat.com > GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E > "And now for something completely different." > -- "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 ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2011-06-08 21:59 UTC | newest] Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-06-06 17:46 TARGET undefined in bucomm.c Luke 2011-06-06 17:58 ` H.J. Lu 2011-06-06 18:19 ` Luke 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
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).