OK, got now a bit further with the fixes . But now it fails while trying to link this lib:
[ 93%] Linking CXX shared library libATen.dylib
Undefined symbols for architecture x86_64:
  "std::runtime_error::what() const", referenced from:
      thrust::system::system_error::what() const in ATen_generated_THCStorage.cu.o
      thrust::system::system_error::what() const in ATen_generated_THCTensorMath.cu.o
      thrust::system::system_error::what() const in ATen_generated_THCTensorMathScan.cu.o
      thrust::system::system_error::what() const in ATen_generated_THCTensorIndex.cu.o
      thrust::system::system_error::what() const in ATen_generated_THCTensorMode.cu.o
      thrust::system::system_error::what() const in ATen_generated_THCTensorSortByte.cu.o
      thrust::system::system_error::what() const in ATen_generated_THCTensorMaskedByte.cu.o
      ...
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      at::infer_size(at::ArrayRef<long long>, at::ArrayRef<long long>) in ExpandUtils.cpp.o
      at::inferExpandGeometry(at::Tensor const&, at::ArrayRef<long long>) in ExpandUtils.cpp.o
      at::ArrayRef<long long>::vec() const in ExpandUtils.cpp.o
      at::__printTensor(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, at::Tensor&, long long) in Formatting.cpp.o
      at::native::permute(at::Tensor const&, at::ArrayRef<long long>) in NativeFunctions.cpp.o
      at::native::inferSqueezeGeometry(at::Tensor const&) in NativeFunctions.cpp.o
      at::native::inferSqueezeGeometry(at::Tensor const&, long long) in NativeFunctions.cpp.o
      ...
I even tried to build without CUDA with NO_CUDA=1, but got similar error:
[ 80%] Linking CXX shared library libATen.dylib
Undefined symbols for architecture x86_64:
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      at::infer_size(at::ArrayRef<long long>, at::ArrayRef<long long>) in ExpandUtils.cpp.o
      at::inferExpandGeometry(at::Tensor const&, at::ArrayRef<long long>) in ExpandUtils.cpp.o
      at::ArrayRef<long long>::vec() const in ExpandUtils.cpp.o
      at::__printTensor(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, at::Tensor&, long long) in Formatting.cpp.o
      at::native::permute(at::Tensor const&, at::ArrayRef<long long>) in NativeFunctions.cpp.o
      at::native::inferSqueezeGeometry(at::Tensor const&) in NativeFunctions.cpp.o
      at::native::inferSqueezeGeometry(at::Tensor const&, long long) in NativeFunctions.cpp.o
      ...
  "std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in Context.cpp.o
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in ExpandUtils.cpp.o
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in NativeFunctions.cpp.o
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in CPUByteType.cpp.o
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in CPUCharType.cpp.o
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in CPUDoubleType.cpp.o
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in CPUFloatType.cpp.o
      ...
Tools and environment vars I’m using are as follows:
XCODE 8.3.2 & XCODE Command Line Tools v. 8.2 for macOS 10.12 (Sierra)
PATH="/usr/local/cuda/bin:/usr/local/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
CMAKE_PREFIX_PATH=/usr/local/miniconda3
DYLD_LIBRARY_PATH="/usr/local/cuda/lib"
CUDA 9.0 driver
CUDA 8.0 toolkit with patches
cuDNN 6.0 for CUDA 8.0
Build command:
 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build
RESULT > build1.log 2>&1 
I also tried to downgrade to CUDA driver 8.0 and build then with cuda, but no difference.
What to try next? Could it be that Xcode 8.x.x toolchain is just not compatible with macOS Sierra? The error “undefined symbols” sound a bit like a compatibility problem with the toolchain. As said my experience on Apple’s toolchain is limited so all hints how to debug this are appreciated!