[macports-base] branch master updated: Use old ABI if building ports with MP g++ on 10.4 & 10.5

Ryan Schmidt ryandesign at macports.org
Thu Apr 12 02:31:49 UTC 2018


On Apr 10, 2018, at 17:39, Joshua Root wrote:

> Joshua Root (jmroot) pushed a commit to branch master
> in repository macports-base.
> 
> 
> https://github.com/macports/macports-base/commit/fb72047770987adea88599a7a69bd70e6c61d214
> 
> The following commit(s) were added to refs/heads/master by this push:
> 
>      new fb72047  Use old ABI if building ports with MP g++ on 10.4 & 10.5
> 
> fb72047 is described below
> 
> 
> commit fb72047770987adea88599a7a69bd70e6c61d214
> 
> Author: Joshua Root
> AuthorDate: Wed Apr 11 08:39:03 2018 +1000
> 
> 
>     Use old ABI if building ports with MP g++ on 10.4 & 10.5
> 
>     
> 
>     This maintains compatibility with the system libstdc++ on these
> 
>     platforms.
> 
> ---
>  src/port1.0/portconfigure.tcl | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> 
> diff --git a/src/port1.0/portconfigure.tcl b/src/port1.0/portconfigure.tcl
> 
> index 5ff4b98..ab1c94f 100644
> --- a/src/port1.0/portconfigure.tcl
> +++ b/src/port1.0/portconfigure.tcl
> @@ -76,9 +76,16 @@ proc portconfigure::should_add_stdlib {} {
>      set is_clang [string match *clang* [option configure.cxx]]
>      return [expr {$has_stdlib && $is_clang}]
>  }
> +proc portconfigure::should_add_cxx_abi {} {
> +    set is_oldos [expr {[option os.platform] eq "darwin" && [option os.major] < 10}]
> +    set is_mp_gcc [string match *g++-mp-* [option configure.cxx]]
> +    return [expr {$is_oldos && $is_mp_gcc}]
> +}

Why only on Mac OS X 10.4 and 10.5? Shouldn't we do it on 10.6, 10.7, and 10.8 too, since they also default to libstdc++? MacPorts g++ may not be in the fallback list on 10.6-10.8, but we do have ports using the cxx11 1.1 portgroup, which build with MacPorts g++ with -D_GLIBCXX_USE_CXX11_ABI=0 on those systems.

I wish we had not made a release so quickly after making this change; there was no time to review the change.


>  proc portconfigure::construct_cxxflags {flags} {
>      if {[portconfigure::should_add_stdlib]} {
>          lappend flags -stdlib=[option configure.cxx_stdlib]
> +    } elseif {[portconfigure::should_add_cxx_abi]} {
> +        lappend flags -D_GLIBCXX_USE_CXX11_ABI=0
>      }

I wouldn't have done this as an elseif. It happens to work because the two options are currently mutually exclusive, but I don't think that construct_cxxflags should assume that. It shouldn't know that.


Now that we've made this change and released it, we need to identify all the ports that are not using the cxx11 1.1 portgroup but that are building C++ code with MacPorts g++ (perhaps because they use the compilers 1.0 portgroup and offer gcc variants) and were therefore using the CXX11 ABI.

You wrote a script to identify all the 10.6-10.8 archives on our packages server that link with libstdc++, so that we can delete them after we switch the default to libc++. Could we modify that script to identify all the ports that use the CXX11 ABI, so that we can revbump them (and ensure they're building on 2.4.3) so that they will use the old ABI? Although that might not identify all affected ports, if the ports have gcc variants but one of them is not selected by default.



More information about the macports-dev mailing list