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

Ken Cunningham ken.cunningham.webuse at gmail.com
Thu Aug 18 10:48:24 PDT 2016


Right to the top... 

Thanks for the feedback. You know 100000x more about this than I do, no argument at all there.

Noted...always a possible downside to trying things.

As you can tell, I'm trying to poke around to find a reasonably elegant way to avoid forcing a (basically unnecessary) update to what might be hundreds or thousands of portfiles (or worse, perhaps, trying to get updates pushed through to all the ports they represent) for something the ports obviously feel the system should be doing itself (which is automatically linking  in the correct stdlib, which we have monkeyed with by requiring linking to libc++ in systems that default to libstdc++).

This seemed the cleanest way. 

I'll see if it causes any trouble here, for what that's worth...

K


On 2016-08-18, at 8:55 AM, Joshua Root wrote:

> 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