compilers on Lion

Werner LEMBERG wl at gnu.org
Sun Sep 9 05:45:16 UTC 2018


Ken,


thanks for your detailed answer.

>>   cxx_stdlib         libc++
>>   buildfromsource    always        
> 
> One downside of going with libc++ is that none of the buildbots are
> set up this way, so you will spend a great deal of time building
> stuff.

This is fortunately not a problem for me. :-)

> There is another downside to ponder as well, a bit more complex to
> explain. By going with libc++, you more or less lose compatibility
> with gcc builds -- a somewhat advanced c++ stdlib discussion is
> coming: [...]

I was aware of that.

> For c++11 or newer, the old libstdc++ in /usr/lib/ on Lion does not
> support c++11, and can't be upgraded.  However, macports is designed
> to install libgcc (currently version 8) into ${prefix}/lib and
> _that_ libstdc++ works great for both clang (3.9 or newer) and gcc
> (5 or newer) to link against. So all is good again. gcc 5 or newer
> link against that by default.
> 
> To force clang (3.9 or newer) to link against that newer version of
> libstdc++ you pass the flag -stdlib=macports-libstdc++, and to make
> the software compatible with the old /usr/lib/libstdc++ you pass
> -D_GLIBCXX_USE_CXX11_ABI=0 in the cxx flags. Both of these things
> are done in the background for users when Portfiles include a
> certain "PortGroup", the cxx11 1.1.

What about adding this your explanation to the `LibcxxOnOlderSystems'
page?  In particular, people who are mainly interested in porting C++
GNU software to the Mac (and using it, of course) should rather stay
with libstdc++, if I understand you correctly.  lilypond, for example,
is a command line program and doesn't need any of the special Mac
features...

> There _is_ indeed a way for gcc to build against libc++, as you
> pointed out in a subsequent email, and one of our contributors
> (Rene) went to the trouble of patching gcc to allow it to accept the
> "-stdlib=libc++" flag to make this easy. But in the end, he could
> not get any purchase for his work either from MacPorts or from gcc,
> and so it went dormant.

Please post a link.  Is Rene's patch integrated into macports?

I don't know yet whether lilypond has problems with clang itself or
with libc++.  I can even imagine that those problems have vanished
meanwhile, assuming *functional* compatibility between libc++ and
libstdc++ – both libraries want to adhere to the C++ standard...


    Werner


More information about the macports-users mailing list