standard way to require c++11?

Chris Jones jonesc at hep.phy.cam.ac.uk
Thu Mar 19 10:01:02 PDT 2015


Hi,

The bottom line is there is no clean way of supporting C++11 on 10.8 or 
older. Its can only be done on a best try basis.

Using gcc is a bad idea, this can lead to C++ runtime issues.

In the root6 port we use

# Force a compatible compiler
compiler.blacklist-append *gcc* {clang < 500} macports-clang-2.9 
macports-clang-3.0 macports-clang-3.1 macports-clang-3.2
compiler.fallback-append macports-clang-3.4 macports-clang-3.5

Which means newer systems use the compatible system clang compiler, and 
older system use the macports clang compiler. I think this is the 'best 
effort' solution. It doesn't work on OSX10.6 though, there we simply 
given up support, as least with the root6 port.

Chris

On 19/03/15 16:04, Michael Dickens wrote:
> I have a few ports that have recently moved to requiring c++11 (or,
> maybe, c++0x), and a few to-be-submitted ports that do too, so I'm
> wondering if there's a standard way to specify this requirement -- for
> example, something like:
> {{{
> PortGroup           compilers 1.0
> compilers.setup  require_cxx11
> }}}
> and, then port "does the right thing" by selecting the compiler and
> cxxflags no matter the OS.
>
> I did a quick search through the dports tree, and couldn't come up with
> a single standard way to do this. The closest I found was something
> like:
> {{{
>      PortGroup compiler_blacklist_versions 1.0
>      compiler.blacklist-append *gcc-4.0 *gcc-4.2 {clang < 300}
> }}}
> but, the above does not work on my 10.8 install.
>
>>From what I can gather via testing on my 10.8 install, the clang ports
> support "-std=c++11" only when "-stdlib=libc++" -- which is not the
> default in MacPorts for 10.8 and prior. I haven't tried moving my ports
> install to using libc++, instead leaving it with the default. Hence, it
> looks like I'm stuck using GCC.
>
> GCC 4.7+ do provide full support for "-std=c++11", and it looks like GCC
> 4.[56] provide support for "-std=c++0x" (but, that's old enough now that
> I think I can just limit support to actual c++11).
>
> Anyway, wondering how others have provided c++11 support to the variety
> of OSs MacPorts supports. Thanks! - MLD
> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-dev
>



More information about the macports-dev mailing list