-stdlib=libc++ added to configure.cxxflags but not configure.ldflags

Rainer Müller raimue at macports.org
Tue Jan 26 11:25:23 PST 2016


On 2016-01-26 20:01, Joshua Root wrote:
> On 2016-1-27 05:52 , Rainer Müller wrote:
>> On 2016-01-26 19:13, Joshua Root wrote:
>>> On 2016-1-27 04:55 , Rainer Müller wrote:
>>>> -stdlib=... is a linker flag not for ld itself, but for the clang++ to
>>>> pass the correct library to ld.
>>>>
>>>> I think this should be added to configure.ldflags in the same way it is
>>>> handled for configure.cxxflags.
>>>
>>> Does that work (or even make sense) when linking is not being done with
>>> clang++?
>>
>> How else would you link C++ code if not with clang/clang++?
> 
> LDFLAGS is not only used when linking C++ code.

Ah, of course, now I understand what you are hinting at. At least in my
test, linking C code with -stdlib=libc++ did not add any superfluous
dependency:

$ clang -stdlib=libc++ -o foo foo.c
$ otool -L foo
foo:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

>> The -stdlib=libc++ option is already specific to clang/clang++,
>> gcc/g++ do not understand it.
> 
> But the current check only considers the value of configure.cxx.

It seems like we are getting to the point again at which a compiler
wrapper that only adds the -stdlib=... option for clang++ would be the
better way to implement this...

Rainer


More information about the macports-dev mailing list