This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: TARGET undefined in bucomm.c


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]