How to reliably find the C++11 <array> header?

Joshua Root jmr at macports.org
Fri Oct 31 05:54:39 PDT 2014


On 2014-10-31 21:46 , Ryan Schmidt wrote:
> 
> On Oct 31, 2014, at 4:45 AM, Thibaut Paumard wrote:
> 
>> Building of Gyoto failed on Montain Lion:
>> https://build.macports.org/builders/buildports-mtln-x86_64/builds/18764
>>
>> The error message is:
>> /bin/sh ../libtool  --tag=CXX   --mode=compile /usr/bin/clang++
>> -DHAVE_CONFIG_H -I. -I.. -I../include  -I../include
>> -I/opt/local/include/udunits2/  -I/opt/local/include
>> -DGYOTO_NO_DEPRECATED -D_THREAD_SAFE -pthread
>> -DGYOTO_PREFIX=\"/opt/local\" -pipe -Os -arch x86_64 -stdlib=libstdc++
>> -std=gnu++11 -MT Photon.lo -MD -MP -MF .deps/Photon.Tpo -c -o Photon.lo
>> Photon.C
>> In file included from Worldline.C:20:
>> ../include/GyotoWorldline.h:36:11: fatal error: 'array' file not found
>> # include <array>
>>
>> I don't understand this as the <array> header is part of the C++11
> 
> C++11 requires OS X 10.9 or later. (More correctly: it requires libc++, which is the default on OS X 10.9 and up.)
> 
> Gyoto can apparently deal with the absence of C++11, since the build succeeded on the Snow Leopard buildbot.
> 
> If you're going to disable the use of C++11 for Gyoto, do it based in the ${configure.cxx_stdlib} variable, not the OS X version.

Unless Gyoto does not exchange C++ objects with any other code, in which
case you could set configure.cxx_stdlib to libc++ on 10.6+ and depend on
libcxx.

If it does exchange C++ objects with other code, you *cannot* safely
change cxx_stdlib in the port, you have to keep its global value and
enable or disable C++11 accordingly.

- Josh


More information about the macports-dev mailing list