MacOS – C++11 on Snow Leopard 10.6.8

developmentmacosmacportssnow leopard

I'm trying to install C++11 on 10.6.8, following this macports guide

Unfortunatley the guide fails when I get to step 7: Rebuild cctools and ld64 to use the newer version of llvm:

sudo port -v -n upgrade --force --enforce-variants cctools -llvm34 +llvm40

fails with the error messsage:

In file included from /usr/include/limits.h:64:

/usr/include/machine/limits.h:10:2: error: architecture not supported

#error architecture not supported

/usr/include/machine/limits.h is:

/* This is the `system' limits.h, independent of any particular
   compiler.  GCC provides its own limits.h which can be found in
   /usr/lib/gcc, although it is not very informative.
   This file is public domain.  */
#if defined (__i386__) || defined(__x86_64__)
#include <i386/limits.h>
#elif defined (__arm__)
#include <arm/limits.h>
#else
#error architecture not supported
#endif

 

/opt/local/etc/macports/macports.conf contains:

# CPU architecture to target. Supported values are "ppc", "ppc64",
# "i386", and "x86_64". Defaults to:
# - OS X 10.5 and earlier: "ppc" on PowerPC, otherwise "i386".
# - OS X 10.6 and later: "x86_64" on Intel 64, otherwise "i386".
#build_arch             i386

and

# Space-delimited list of CPU architectures to target when building
# universal. Defaults to "i386 ppc" on Mac OS X 10.5 and earlier,
# "x86_64 i386" on Mac OS X 10.6 through macOS 10.13, and "x86_64" on
# macOS 10.14 and later (the 10.14 SDK is not universal).
#universal_archs        x86_64 i386

Does anyone have a working method to install C++11 on 10.6.8?

Best Answer

The process to install c++11 on 10.6.8 on MacPorts has recently been automated, and for the majority of users, now happens automatically. The previous instructions you were following are no longer necessary.

The installation process leads to MacOSX 10.6.8 running with a reasonably current libc++, clang-8.0 (at present -- clang-9.0 is available as well), and the required underpinnings in cctools (assembler, ranlib, etc) and ld64 (linker) to install software requiring the currently available c++17 standards, and newer as clang/llvm progress.