small change in portconfigure.tcl appears to fix missing cxx_stdlib link

Joshua Root jmr at macports.org
Thu Aug 18 08:55:16 PDT 2016


On 2016-8-19 01:13 , Ken Cunningham wrote:
> For your consideration
>
> this small change in /base/src/port1.0/portconfigure.tcl
>
>        # Add flags to specify C++ STL implementation
>        if {${configure.cxx_stdlib} ne "" && [string match "*clang*" [option configure.cxx]]} {
>            append_to_environment_value configure CXXFLAGS -stdlib=${configure.cxx_stdlib}
>            append_to_environment_value configure OBJCXXFLAGS -stdlib=${configure.cxx_stdlib}
>            #kenhack
>            append_to_environment_value configure "LDFLAGS"  -stdlib=${configure.cxx_stdlib}
>        }
>
> appears to fix the missing link reference to the standard c++ lib, and as far as I can see would apply to all ports.
>
> It works well here, so far, to fix the missing libc++ link without modifying the portfile.
>
> Will test further to see if it causes any unforeseen troubles on my other macports systems running different OS versions, but this would not appear likely to cause trouble to me...

The trouble is that LDFLAGS is not specific to C++, it's used when 
linking everything. At best, the link command will ignore -stdlib, at 
worst, it may fail when given an option it doesn't recognise. (This is 
much the same reason why it checks that configure.cxx is clang++ as well.)

- Josh


More information about the macports-dev mailing list