From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11163 invoked by alias); 8 Jun 2011 16:55:22 -0000 Received: (qmail 11155 invoked by uid 22791); 8 Jun 2011 16:55:21 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_BJ,TW_BP,TW_CX,TW_DC,TW_GX,TW_VT 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; Wed, 08 Jun 2011 16:55:05 +0000 Received: by vws4 with SMTP id 4so687153vws.0 for ; Wed, 08 Jun 2011 09:55:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.0.228 with SMTP id 4mr940634vdh.107.1307552104639; Wed, 08 Jun 2011 09:55:04 -0700 (PDT) Received: by 10.52.184.8 with HTTP; Wed, 8 Jun 2011 09:55:04 -0700 (PDT) In-Reply-To: References: <20110608091959.GD4172@bubble.grove.modra.org> Date: Wed, 08 Jun 2011 16:55:00 -0000 Message-ID: Subject: Re: TARGET undefined in bucomm.c From: Luke To: Ian Lance Taylor 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/msg00102.txt.bz2 > You didn't show the command here. =C2=A0Did it have -I. first, as it shou= ld? > If so, I don't see how that #include search path is possible. =C2=A0And w= hat > is /home/luke/usr/include doing on the search path? =C2=A0Do you have CPA= TH > 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=3D"\"/usr/local/share/locale\"" -Dbin_dummy_emulation=3Dbin_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=3Dgcc COLLECT_LTO_WRAPPER=3D/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=3D'Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=3Dfile:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=3Dc,c++,fortran,objc,obj-c++ --prefix=3D/usr --program-suffix=3D-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=3Dx86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=3D/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=3Dposix --with-gxx-include-dir=3D/usr/include/c++/4.5 --libdir=3D/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=3D/ --enable-clocale=3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --enable-plugin --enable-gold --enable-ld=3Ddefault --with-plugin-ld=3Dld.gold --enable-objc-gc --disable-werror --with-arch-32=3Di686 --with-tune=3Dgeneric --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --target=3Dx86_64-linux-gnu Thread model: posix gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) COLLECT_GCC_OPTIONS=3D'-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=3D"/usr/local/share/locale"' '-Dbin_dummy_emulation=3Dbin_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=3Dgeneric' '-march=3Dx86-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=3D"/usr/local/share/locale" -Dbin_dummy_emulation=3Dbin_vanilla_emulation ../../binutils-2.21/binutils/bucomm.c -D_FORTIFY_SOURCE=3D2 -quiet -dumpbase bucomm.c -mtune=3Dgeneric -march=3Dx86-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=3D100 --param ggc-min-heapsize=3D131= 072 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=3D100 --param ggc-min-heapsize=3D131= 072 Compiler executable checksum: 9755ab75799195519479ef699703b13b ../../binutils-2.21/binutils/bucomm.c: In function =E2=80=98set_default_bfd= _target=E2=80=99: ../../binutils-2.21/binutils/bucomm.c:160:24: error: =E2=80=98TARGET=E2=80= =99 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=3D$HOME/usr/include:$C_INCLUDE_PATH and this is what it is set to immediately prior to the configure and make s= teps: $ 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=3D/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