gcc compiles with incorrect g++ include paths

Lack Mr G M gml4410@ggr.co.uk
Mon Jun 12 10:49:00 GMT 2000


 
   I have just compiled gcc version 2.95.2 for a Solaris 2.6 and an SG
Irix6.5 system.

Solaris system:
Reading specs from /usr/central/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)

Irix system:
Reading specs from /usr/central/lib32/gcc-lib/mips-sgi-irix6.5/2.95.2/specs
gcc version 2.95.2 19991024 (release)


   The compiler runs Ok.  The problem is that g++ can't find it's
include files.  It is looking in the incorrect place.


   I have a set of automount maps that include architecture-specific and
architecture neutral mounts.  So I run configure like this:

 CC=cc \
  ../gcc-2.95.2/configure \
   --prefix=/usr/common --exec-prefix=/usr/central \
   --with-local-prefix=/usr/central

(for Irix I then edited the top-level Makefile to change
 libdir =${exec_prefix}/lib
to
 libdir = ${exec_prefix}/lib32
which since that fits better with the SGI setup, but that worked Ok,
basically.  It isn't the cause of the problem, as Solaris suffers the
same way).

   The problem stems from the fact that the install node of the Makefile
in libio ends up installing _G_config.h into $(tooldir)/include/.  For
my Irix system $(tooldir) is set to /usr/central/mips-sgi-irix6.5.

[Interestingly, or even alarmingly, if
 "enable_version_specific_runtime_libs" were set then it would install
 this file into /usr/common/include, which is an architecture independent
 location!].

   The rest of the header files are installed into $(gxx_include_dir).
This has the value /usr/common/include/g++-3.

   However, for the gcc compilation gxx_include_dir is set to the result
of this calculation (when written as one line):

gxx_include_dir=
/usr/central/lib32/gcc-lib/mips-sgi-irix6.5/2.95.2/../../../..
`echo /usr/central | sed -e 's|^/usr/common||' -e 's|/[^/]*|/..|g'`
/include/g++-3"


which actually evaluates to /include/g++-3.

   The problem seems to arise from the gcc Makefile wishing to calculate
gcc_gxx_include_dir on its own (which is what produces the long command
line above) but gets it completely wrong.  It assumes it is under
libdir, which is architecture dependent for a start, but it is actually
under prefix, which isn't.


   I suspect that the failure to find _G_config.h (which is in
$(tooldir)/include/) is related, since the gcc Makefile tries to work
out gcc_tooldir in the same way as it tries to get gcc_gxx_include_dir,
and so fails.



   Gordon Lack
   Application Environmentalist           12 June 2000


More information about the Gcc-bugs mailing list