On 10 Dec 2001, Camm Maguire wrote:
> Greetings! The gcc suite >=3.0 requires linking in libstdc++ when
> linking c++ objects. When the linker is called by the name 'c++' or
> equiv., this happens automatically, just as libg2c.a is added when the
> linker is invoked via f77/g77. Earlier gcc suites did not require the
> -lstdc++, apparently. In any case, the wrapper compilers handle c++
> fine, as they invoke c++, but for fortran and C they add -llammpi++ to
> the command line, without the implicit -lstdc++, and this fails.
Erf. We didn't anticipate that.
> One easy solution is to just add -lstdc++ to LAM_SYSLIBS, or some
> such. This is a bit ugly though for distributions, such as Debian,
> which will have different default compilers on different
> architectures. Surely we don't want the arbitrary overhead of
> requiring everyone who compiles any mpi program in any language to
> link in lammpi++, libstdc++, and have a working c++ setup, etc.
Absolutely.
> For hcc, there is a somewhat simple patch:
>
> [patch snipped]
>
> This assumes that one never wants to use gcc to link when one's code
> has c++, which really makes sense. Likewise, the block in hf77.c
> which adds in -llammpi++ can safely be commented out, to my
> understanding. As the comment preceding it says, its only there for
> the obscure case of calling c++ code from fortran. I really don't
> even know if this is possible! In any case, I've put these two fixes
> in the Debian package to close a bug as a temporary measure. I'd be
> happy to implement whatever you guys think best.
Your analysis is right on the money -- you have to use a C++ compiler to
link C++ programs. Hence, it doesn't make sense to add the C++ bindings
library when linkinig with mpicc or mpif77.
Must have been a mental lapse when we did that... or perhaps a bit of
confusion because hcc is schitzofrenic in that it is actually "mpicc" and
"mpiCC". That is, hcc checks a special environment variable to see if it
should do C++ things -- don't ask). There's a good chunk of logic in
hcc.c that deals with this issue. hcc used to be a fairly simple thing,
but maybe it's time that we separated mpiCC off into its own executable to
avoid this kind of confusion... hmm...
I'll apply your patch to the CVS head; thanks!
I'd prefer not to do another 6.5.x release if possible; we're trying to
kill off the 6.5 line. If the bug list grows too long, we'll do a 6.5.7,
but I'd like to avoid it if possible.
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
_______________________________________________
This list is archived at http://www.lam-mpi.org/MailArchives/lam/
|