C++11 on Mountain Lion and lower?

Titus von Boxberg titus at v9g.de
Wed Dec 4 01:52:28 PST 2013


Am 04.12.2013 01:24, schrieb Christopher Jones:
> Hi,
>
> This is more what I was thinking for this case. Have the port use a newer c++11 enabled version on OSX versions that support it, and a older version where they don’t.

Hi,

maybe I got lost in this thread but I think multiple issues
get mixed up.

I try to summarize some points here in the hope that it's useful.

- C++11 code requires a recent version of libc++ or libstdc++
- same with other c++ code that for any reason needs a more
   recent version than Apples g++ implementation.
- The only C++ runtime that Apple provides on all systems since 10.5(?)
   is the one delivered with gcc 4.2.1. I really doubt that Apple
   will change that to a recent libc++
- I don't see what the question of C++11 support and thus
   the c++ library version has to do with the OSX version besides,
   presumably, that 10.9 is the first OSX release with full (?) C++11
   support in the preinstalled C++ standard library.
   macports provides two recent C++ implementations, clang/libc++ and
   FSF g++, that both work on systems earlier than 10.9
- I doubt but don't know whether there are any other C++ libraries
   in /usr/lib (besides a stone old implementation of wxWidgets on 10.6)
   Using them within macports would collide with the macports
   philosophy not to use more of the base system than necessary.
- An executable loading more than one implementation of the
   C++ standard library is asking for undefined behaviour.
- You should not mix up different C++ standard libs in
   one address space, regardless of whether both are libstdc++ or not.
   It's the job of macports to ensure that for the C++ executables
   it compiles.
- more and more C++ ports will start to require C++11, or at least
   newer C++ implementations than the the one shipped with the
   ubiquitous gcc 4.2.1
- currently, there might still be some ports that require g++


Thus given the theoretical possibility to provide a (the same)
recent C++ runtime for (all) OSX (versions), then I'd see
these questions:

How many C++ ports really require something newer than gcc 4.2.1?
Are they used by many macports installations?
How does the estimated growth rate of these ports relate to
the estimated phase out rate of older OSX installations?
In short, how bad is the pain to drop the idea of C++11 on OSX < 10.9?
And the other way round:
Down to which OSX version shall macports be responsible for providing
a recent C++ runtime and how much effort should that take?

I don't know macports well enough to answer these questions,
but here are some guesses trying to be educated:
The only C++ runtime on osx that I'd expect to have long term support
is clang/libc++. Then I'd first rule out using
a newer self-built g++ since that collides with the
reasons to use clang/libc++, anyway.
My second guess is that I'd drop the whole idea of macports
providing its own C++ implementation ;-)

Additionally, c++ libraries compiled by macports might be used
in own non-macports software projects.
This own software might also require a newer C++ implementation
than the one used by macports.
I don't think that macports should be responsible for this although
that's something that I could well use.
When I started using C++11 in my software I just used macports
compiler packages and manually installed all C++ libraries I needed.

Just my €0,014725

Regards,
Titus




More information about the macports-dev mailing list