LibCxxOnOlderSystems - and more software that is pushing for gcc

Lawrence Velázquez larryv at
Sun Sep 25 07:47:47 PDT 2016

> On Sep 25, 2016, at 8:29 AM, Ken Cunningham <ken.cunningham.webuse at> wrote:
> What is happening exactly on my MacPros running 10.11, I wonder?
> Software installed by macports on 10.11 is using clang++ (mostly) and
> g++ (sometimes).

What MacPorts-provided software is using g++? It should not be doing

> clang++ is linking against libc++, and g++ is presumably linking
> against libstdc++ as that is what it does

> Why exactly is the situation different on a LibCxxOnOlderSystems
> installation?

As Chris said, it's easier to get lucky and avoid conflicts mixing two
libstdc++/libsupc++ than it is mixing libstdc++ and libc++.

There is no fundamental difference, just an increase in visibility.

>> As far as I know, you can use the C or Fortran compilers as much as
>> you'd like. Several ports do this for various reasons. 
> But not easily to link c++ code against libc++.


>> These dependencies are coming from the +gfortran variants, which
>> instruct the builds to use the Fortran compiler from gcc6. This is
>> fine and expected.
> but won't work on LibCxxOnOlderSystems, if it links the binaries
> against lilbstdc++

Why would the Fortran compiler link its build products against
libstdc++? Are you seeing this behavior?

>> What links against libstdc++, specifically?
> gcc6 itself, at least.

This is not a problem unless GCC provides C++ API.

> It would appear there are a few choices.
> 1. give up and accept it's an either / or situation
> 2. just let it go on, and see how it works with cross linking -- is this
> what 10.11 macports does?

No. No MacPorts-provided software should be compiling with
MacPorts-provided FSF g++. We consider such behavior a bug.

> 3. figure out how to make this work:
> <>,
> possibly by wrapping g++ in a shell script that does it for every use.

I don't think it's worth accommodating g++ at all. MacPorts should not
be using it, and anyone who wants to use it for their own projects might
not appreciate us hijacking its default C++ standard library.

Apple handled this in their olde tyme libstdc++ by fixing it to use
libc++abi instead of libsupc++.

> 4. a parallel installation of macports with libstdc++ and gcc, to
> install gimp, octave, qemu, and whatever other similar gcc-requiring
> ports come along.

Please provide evidence that these ports are actually using g++. If they
are, then they should be fixed to not do so. If they are not and are
only using gcc and/or gfortran, then *there is no problem*.

FWIW, I have py35-numpy+gcc6 installed, and none of its object files
link to libstdc++, although many of them do link to MacPorts'

% port -q contents py35-numpy | xargs otool -L | fgrep 'libstdc++'
% echo $?


More information about the macports-users mailing list