In a mess with libc++ libstdc++ and OSX 10.7.5 Lion

Mojca Miklavec mojca at
Thu Sep 14 08:08:54 UTC 2017

On 14 September 2017 at 06:30, Ian Wadham wrote:
> I am in a right royal mess with some KDE 4 applications and libraries from MacPorts
> on which I depend.  After a failed "sudo port upgrade outdated" run all my KDE 4 apps
> give OSX popup messages like "kmymoney cannot be opened because of a problem"
> and they wil not start.  The most serious (for me) is KMyMoney, which holds all my
> finances and investments, and it is time for me to do annual accounting and tax.
> I am using OSX 10.7.5 Lion and MacPorts 2.4.1.
> It was some time since I had done a port upgrade outdated, maybe a year or more.

That's generally a long time period.

> However a "sudo port selfupdate" showed that I was already at macports 2.4.1.  I then
> ran and saved lists of requested and outdated ports and uninstalled a few ports I no
> longer need.  Then I started "sudo port upgrade outdated".
> The terminal output ended with multiple repetititions of:
> Warning: reinplace /include/s@\(utils\.h\)@src/\1 at g didn't change anything in /opt/local...

This is totally harmless. It could be fixed, but it won't affect you.

> Followed by:
> --->  Configuring akonadi
> Error: akonadi does not support your selected MacPorts C++ runtime. libc++ must be selected and C++-based ports built against it.

As Ken suggested, you could try to open that Portfile (check "port dir
akonadi") and replace

    PortGroup           cxx11   1.0


    PortGroup           cxx11   1.1

and hope that it will succeed.

> 1. Do I need to do any cleanup of the failed run before doing anything else?  If so,
>      what command(s) should I use?

Yes, generally, whenever a port fails to build it's a good idea to run
"port clean <portname>", then fix something and run "sudo port -v
install <portname>" again. That will compile to the end. (If you need
to manually patch something little in the sources that you discover
while running the build, it's better if you don't clean it, else you
need to provide a "permanent patch", but that's a different story.)

> 2. I had a local ports tree that I no longer use.  I have commented out the reference
>     to it in sources.conf but do I need to re-run portindex?


>  Or would that have been
>     taken care of when I ran "sudo port selfupdate"?  I have not found any way to
>     re-index and include just the standard ports.

You only need to run portindex to generate an index of a new or
updated ports tree. If you remove a local tree, you only need to
remove the reference. Portindex is generated at the location of the
ports tree.

> 3. Can I revert to earlier versions of apps and libraries (which could at least be used
>     to keep my accountant happy)?  If so, what commands should I use?  There are
>     scores, maybe hundreds, of ports to be reactivated and there are probably lots
>     that are old but still active, because the upgrade run never got to them.

You can run "port installed" to check which ports you have installed.
Then you run
    sudo port activate portname at version
for all the ports in question. That is, assuming you didn't delete any of them.

If you know the point in time when all the ports worked you can also
do a git checkout of the tree, switch to an old commit (from
approximately the time when everything worked) and use that one as the
main ports tree. Then you will get all the old versions back.

> 4. If I stay with Lion, I understand that I have to uninstall everything, make some
>     adjustments to macports.conf and then re-build from source and continue to
>     do so into the future.

You also need to keep in mind that the number of people (developers in
particular) testing the changes on Lion is converging to zero.

On Lion you have an option to either use the method mentioned by Ken
(cxx11 1.1 portgroup) or go for libc++ installation (reinstall all
packages), but any of those options will require manually dealing with
compilation issues every now and then, so you should better not be
afraid to fix Portfiles.

An additional problem is that if you are looking for KDE, it requires
Qt which is a moving target which is constantly dropping support for
older OSes. So unless someone tested it for you and removed the
problems, you might run into getting a too new version of KDE that's
no longer supported on 10.7 and you might need to adapt the
dependencies manually.

You need to be aware that if you go for libc++, at the time being
you'll have to compile everything from source which is particularly
painful for all the compilers and Qt. Depending on your hardware (I
assume it's not the latest one if you still have 10.7 installed) it
might literally take days before you have done
compiling/debugging/starting the next round/... even if you won't have
to intervene much.

>     OTOH I could go down to the Apple shop and get them to upgrade me to Sierra
>     and then I could re-install MacPorts apps from binaries but I would also have to
>     upgrade other non-Apple software I depend on a lot every day, mainly Firefox
>     and LibreOffice.

If your hardware supports Sierra, that would by far be the best
option. If reinstalling Firefox and LibreOffice is an "issue",
maintaining MacPorts on 10.7 will be much bigger headache.

>     Either approach could take days (elapsed) and many hours of computer time.
>     Which way would be best for me to go?
> I used to be a KDE developer until about 2 years ago, so I am happy working with
> commands and scripts, and I have saved lists of requested ports and of the new and
> old versions of outdated ports.

If you are in a hurry to submit your paperwork, I would find a git
commit corresponding to the time point that corresponds to the
versions of outdated ports which you know worked for you, checkout
that commit and install again from there. Then, as soon as the
deadline is over, the least painful way will be switching to Sierra.

Of course any of your efforts to make MacPorts work betten on older
systems could benefit other users, but it might take some time to get
things working.

You could also try to install another instance of MacPorts with libc++
to a different prefix and see how that goes (keeping in mind that the
latest Qt is not supported on 10.7 anyway).


PS: I'm successfully using 10.7 with default libstdc++, but I usually
need to find workarounds for new broken ports about twice per month on
average and I'm not using Qt that much. But I'll probably buy new
hardware and keep this one for sentimental reasons :) :) :).

More information about the macports-users mailing list