Switching cxx_stdlib for C++11 on legacy macOS (was: Re: [GSoC] migration)

Rainer Müller raimue at macports.org
Sat Sep 2 16:25:08 UTC 2017

On 09/02/2017 03:18 PM, Umesh Singla wrote:
> On Thu, Jun 15, 2017 at 12:05 AM, Mojca Miklavec <mojca at macports.org
> <mailto:mojca at macports.org>> wrote:
>     On 14 June 2017 at 05:47, Umesh Singla wrote:
>     >
>     > Okay, since there's already a OS comparison made, which I think can be
>     > directly used here. But to clarify, just the OS check? a check on x86_64/ppc
>     > changes is also needed.
>     And potentially cxx_stdlib?
> How can such a check be made possible? All we have at present is here, [0]. It
> doesn't compare stored values and current platform values. Are you suggesting a
> manual check while migration?

I do not think we need any special check at migration, as a rebuild will always
use the current setting in macports.conf. However, after editing the default
cxx_stdlib in macports.conf all affected ports need to be rebuild and linked
with the new default to avoid problems later when installing new ports.

The following goes beyond your GSoC project, but I think it fits into this
discussion. Back in May, I published an experiment on my GitHub repo that I had
lying around. This adds functionality to stores the cxx_stdlib option in
registry, such that 'port outdated' will consider ports as outdated if the
registry entry does not match the cxx_stdlib option in macports.conf.

This was originally written to support switching the cxx_stdlib from libstdc++
to libc++ on old releases of OS X in order to support C++11. However, I
personally lost interest to support legacy systems any longer and do not run any
of them any more.


WARNING: Do not install this commit/branch over your regular prefix as
it will upgrade the SQLite registry.db and make it incompatible with
MacPorts 2.4.x or master!

I am not sure how useful this experiment is yet, because this approach
still has a number of problems and shortcomings:

* show stopper: cxx_stdlib is stored for all ports, not only those
  actually linking against the C++ stdlib
* cxx_stdlib cannot be changed separately for a single port
  This might be necessary for some ports that want to link against
  system frameworks and do not link against anything else. Such a port
  is now always be considered outdated.
* I did not know/think of libstdc++ vs. macports-libstdc++
* archivefetch does not yet respect cxx_stdlib in any way

For some of these problems, I don't know how they should be solved,
especially the first show stopper. But maybe this helps to get the ball
rolling a bit more.


More information about the macports-dev mailing list