CUDA 8.0 on Mac OS/X

November 30, 2016

CUDA 8.0 on Mac OS X 10.12 gave me the following error:

The version ('80000') of the host compiler ('Apple clang') is not supported

So there is a mismatch between the new Xcode 8.1 and the new CUDA 8.0.

$ make
/usr/local/cuda/bin/nvcc -ccbin clang -m64 --std=c++11 -O2 -lineinfo --relocatable-device-code true -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_30,code=sm_30 -o Main.o -c Main.cpp
nvcc fatal   : The version ('80000') of the host compiler ('Apple clang') is not supported
make[1]: *** [Main.o] Error 1
make: *** [map/Makefile.ph_build] Error 2

I had the following version of clang installed

$ clang --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Solution

  1. Download the “Command Line Tools (OS X 10.11) for Xcode 7.3.1” from developer.apple.com.
  2. Install them
  3. Set them as the default with
sudo xcode-select --switch /Library/Developer/CommandLineTools

Now clang says it is version 7.3

clang --version
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

And nvcc works again.

Make sure that you do not update the developer tools again. Mac OS X will offer an update of the “command line tools” via the app store as soon as it detects that the older version is active.

Thanks to the developer blog of NVIDIA for pointing this out.