avoid linking to two different libstdc++

Kasper Peeters kasper.peeters at phi-sci.com
Thu Jul 11 08:05:47 PDT 2013


Hi,

I am the author of 'cadabra', which was originally written on Linux and
uses various standard libraries on that platform, among which gtkmm and
dependencies.

For reasons that are irrelevant to this post, I cannot compile cadabra
with clang or llvm-gcc (it contains some legacy code which makes use of
features not supported by these compilers). So I am forced to select
gcc in macports. I am currently setting

   configure.compiler   apple-gcc-4.2

and this works.

If I allow for a larger subset of gcc compilers (even just including
gcc-4.2, i.e. the macports one), then I end up with a binary which is
linked to two different libstdc++ libraries (the macports one and the
apple one). I suppose this is a consequence of linking to e.g. gtkmm.
The result of this is malloc/free failures all over the place
(presumably because there are now two libstdc++ libraries fighting
over who gets to manage memory).

So the concrete question is: if I absolutely need gcc to compile my
program, how can I make sure that I do not end up with a binary which
is linked to multiple copies of libstdc++?

For completeness: the package as it sits in the repos is broken, and
the fix discussed above is at https://trac.macports.org/ticket/38938,
but has not been uploaded to the repos yet.

Cheers,
Kasper


More information about the macports-dev mailing list