This is the mail archive of the mailing list for the GCC project.

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

value of $CXX when building libraries

(See also my bug report libgcj/1572.)

When building libstdc++-v3 CXX is set to point to the newly-built
compiler.  $CXX does *not* contain the -I flags needed; instead those
are part of $INCLUDES.

All very well - but what happens when building some other target library
written in C++ - specifically libjava?  The value libjava uses for $CXX 
*includes* the libstdc++-v3 header directories:  When libjava is
configured it add the directories listed in libstdc++-v3/src/libstdc++.INC
to $CXX.  Thus building libstdc++-v3 uses one value of $CXX - and
building libjava uses another value - and they share the same config.guess!
Obviously this is quite fragile, and in fact it seems to prevent "make
boostrap" from working.  I don't really understand why it works with
"make all" and why it fails with "make boostrap", and if I did I guess we
could fix the immediate problem.  But it seems to me that using different
values of $CXX for different target libraries is inherently fragile and
to be avoided.

My feeling is that it is libstdc++-v3 that should be changed to use
a version of $CXX is that is "complete".  I feel that $CXX should
override g++, just as $CC should override gcc.  In both cases they
should include whatever options are needed to compile target libraries.
Currently it includes -L and -B flags; it should also include -I flags.
After all, compiling target libraries should not have to depend on
knowing the internals of libstdc++-v3, even if it is just the INC file.

Adding all these files to the gcc/g++ command line makes for very
long command lines.  This makes it harder to watch and scan the make
output.  It would be nice if we could factor those out. So I suggest
either of:

(a) Create a temporary shell script or binary to be used solely for
compiling target libraries:
        exec /home/bothner/GNU/linux-gcc/gcc/g++ -B... -L.. -I.. "$@"
This could be called "new-g++" by analogy with "new-as" and "new-ld".
I don't know which directory to put it in; either libstdc++-v3 or
some new "target-bin" directory, possible i686-pc-linux-gnu/bin.
In that case we could just call the script "g++" and have to option
of just setting $PATH to include i686-pc-linux-gnu/bin.

(b) Create a specs file that lists (the equivalent of) the appropriate
-B, -L and -I flags.  Then the targegt Makefiles would do something
        /home/bothner/GNU/linux-gcc/gcc/g++ -specs=...
(I don't know enough about specs files to know if this makes sense.)

Of course whatever solution we come up with for $CXX we should
probably also do for $CC.  It is just that the problem is worse
for $CXX because of libstdc++.

This problem prevents "make bootstrap" from building libjava, so it
is rather critical to get it fixed before gcc 3.0!
	--Per Bothner

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