g++ can't locate iosfwd

Maciej Bliziński maciej@opencsw.org
Thu Aug 25 07:31:00 GMT 2011

2011/8/25 Ian Lance Taylor <iant@google.com>:
> Maciej Bliziński <maciej@opencsw.org> writes:
>> Interestingly, it looks like the include files are found underneath
>> what was probably configured as libdir (PREFIX/lib).  In my build,
>> I've defined prefix to /opt/csw/gcc4, but I have set libdir to
>> /opt/csw/lib.  How does gcc get the idea to search
>> /opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.3.3/../../../../include/c++/4.3.3
>> for the include files? Is it defined in a file such as config.h?
> Look for unlibsubdir and libsubdir_to_prefix in gcc/Makefile.in.

Yes, looks like the libsubdir_to_prefix calculation goes wrong. Here
are the results for my build.  I added a target to print debug
information and ran it.

        @echo "prefix: $(prefix)"
        @echo "libdir: $(libdir)"
        @echo "unlibsubdir: $(unlibsubdir)"
        @echo "libsubdir_to_prefix: $(libsubdir_to_prefix)"

maciej@unstable10s [unstable10s]:~/src/opencsw/pkg/gcc4/branches/gccgo
> (cd work/solaris10-sparc/build-isa-sparcv8/objdir/gcc ; gmake
prefix: /opt/csw/gcc4
libdir: /opt/csw/lib
unlibsubdir: ../../..
libsubdir_to_prefix: ../../../../../../

If prefix is /opt/csw/gcc4 and libdir is /opt/csw/lib, then
libsubdir_to_prefix must have "gcc4" at the end, otherwise it's

Perhaps I've run into this problem, because I'm setting the build in a
an unusual or wrong way.  What I want, is having the libraries in
/opt/csw/lib and the binaries in /opt/csw/gcc4/bin, and I don't care
much where everything else lives.  I can either set prefix to
/opt/csw/gcc4 and libdir to /opt/csw/lib, or prefix to /opt/csw and
some other settings to /opt/csw/gcc4. Which way is better?


More information about the Gcc-help mailing list