I envision a serious problem for C++ builds of GCC.  The next 3
paragraphs provide some context on how I came across it, but are not
critical to understand it, so feel free to skip.

For the past several hours, I've been trying to get the GCC build
machinery to come to terms with gmp in the build tree.  My earlier
attempts seem to have not taken into account the need for libgmpxx, that
such packages as ppl (and cloog?) display and thus bring into gcc
compilers.

The problem I'm running into ATM is that libgmpxx, in the build tree, is
built as a static library, which does not bring the required libstdc++,
which C programs linking with libgmpxx need.  OTOH, building it as a
dynamic library wouldn't quite work, for we don't install the in-tree
built gmp, and, from the number of tricks I have to employ to get ppl et
al to build, I get the impression that they don't expect to find gmp in
its build tree.

I don't have a solution for this yet, other than explicitly mentioning
-lstdc++ (and -lm) in --with-host-libstdcxx.  The reason I hadn't
noticed it before was that I happened to have a dynamic libgmpxx
installed, and this used to be used for my in-tree PPL builds.  This
issue became apparent, however, when one of the hosts I use for building
was upgraded from Fedora 12 to 13: for reasons as yet undetermined, GNU
ld in Fedora 13 fails to link with libgmpxx, unless libstdc++ and libm
are linked in explicitly.  This is inconvenient, but not such a big
deal.

Anyhow, the problem I envision is that of having two different C++
libraries linked into a single GCC program.  Consider a pre-installed
libgmpxx.so that requires libstdc++.so.N.  Further consider we're
bootstrapping GCC and we get on to stage2, using the stage1 g++
(--enable-build-with-cxx) and libstdc++.so.N+1.

This will link both versions of libstdc++.so into the compilers created
in stage2.  This might fail to link, or it may fail to run while trying
to build target libraries.

I'm not sure what, if anything, we ought to do about this.  Basically,
the only way around this is to bootstrap gmpxx and ppl along with the
compilers.  Perhaps, once we bump the libstdc++ major, we should
warn/refuse to configure to build-with-cxx, if gmp (and ppl?) is not
being bootstrapped along with the compiler, and the pre-installed
version uses the old libstdc++ major.  Of course we can also do nothing
and let the build fail later on, but this strikes me as undesirable.

No immediate action is required, but we'll eventually have to deal with
this if we keep on using external C++ libs.

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Reply via email to