Mac OSX - CUDA 8.0 not compatible with clang 8.0.0

When trying to compile the sample apps I get the following error:

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

I couldn’t find any NVIDIA documentation regarding supported versions of clang. Is this expected? How are others working with CUDA on latest clang on Mac?

the supported llvm versions are contained in the installation guide. The installation guide is installed on your machine when you install cuda 8, and it is also linked from the download page where you downloaded the cuda 8 installer.

[url]https://developer.nvidia.com/compute/cuda/8.0/rc/docs/sidebar/CUDA_Installation_Guide_Mac-pdf[/url]

Thank you for that information. For others that may come across this problem, this is what I did to compile the samples from CUDA 7.5. I was not able to fully compile 8.0 due to the lnvgraph library not found (https://devtalk.nvidia.com/default/topic/949351/cuda-8-rc-example-nvgraph-not-found-library-not-found-for-lnvgraph-/):

  1. Downloaded Command Line Tools for XCode 7.3 from Sign In - Apple
  2. Ran the following command on terminal to switch my active clang version:
sudo xcode-select --switch /Library/Developer/CommandLineTools

Thanks for posting this. I am also having this problem and this fixed it. Updating is a dangerous game to play.

I downgraded to Xcode 7.2 and I am still getting the following errors with cuDNN using CUDA 7.5:

iMac:cuda-samples ssc$ make
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -ccbin clang++ -I../../common/inc  -m64  -Xcompiler -arch -Xcompiler x86_64  -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_52,code=compute_52 -o asyncAPI.o -c asyncAPI.cu
/usr/include/stdio.h(133): error: expected a ")"

/usr/include/stdio.h(134): error: expected a ")"

/usr/include/stdio.h(134): error: "_Nullable" has already been declared in the current scope

/usr/include/stdio.h(135): error: expected a ")"

/usr/include/stdio.h(135): error: "_Nullable" has already been declared in the current scope

/usr/include/stdio.h(136): error: expected a ")"

/usr/include/stdio.h(136): error: "_Nullable" has already been declared in the current scope

/usr/include/stdio.h(477): error: duplicate parameter name

/usr/include/stdio.h(478): error: duplicate parameter name

/usr/include/stdio.h(479): error: duplicate parameter name

/usr/include/stdlib.h(139): error: expected a ")"

/usr/include/stdlib.h(158): error: expected a ")"

/usr/include/stdlib.h(294): error: expected a ")"

/usr/include/stdlib.h(300): error: expected a ")"

/usr/include/stdlib.h(306): error: expected a ")"

/usr/include/stdlib.h(312): error: expected a ")"

/usr/include/stdlib.h(318): error: expected a ")"

/usr/include/pthread/qos.h(113): error: expected a ")"

/usr/include/pthread/qos.h(185): error: expected a ")"

/usr/include/pthread.h(216): error: duplicate parameter name

/usr/include/pthread.h(217): error: duplicate parameter name

/usr/include/pthread.h(243): error: expected a ")"

/usr/include/pthread.h(247): error: expected a ")"

/usr/include/pthread.h(326): error: expected a ")"

/usr/include/pthread.h(340): error: duplicate parameter name

/usr/include/pthread.h(350): error: duplicate parameter name

/usr/include/pthread.h(353): error: expected a ";"

/usr/include/pthread.h(356): error: expected a ")"

/usr/include/pthread.h(493): error: duplicate parameter name

/usr/include/pthread.h(529): error: expected a ")"

/usr/include/pthread.h(540): error: variable "_Nullable" is not a type name

/usr/include/pthread.h(540): error: "pthread_t" has already been declared in the current scope

/usr/include/pthread.h(540): error: expected a ";"

/usr/include/pthread.h(543): error: duplicate parameter name

/Applications/Xcode7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/mutex(262): error: variable "pthread_t" is not a type name

35 errors detected in the compilation of "/var/folders/m1/b_t9_2151y30ryvtr_2gznch0000gp/T//tmpxft_0000a179_00000000-22_asyncAPI.compute_52.cpp1.ii".
make[1]: *** [asyncAPI.o] Error 2
make: *** [0_Simple/asyncAPI/Makefile.ph_build] Error 2</li>

I downgraded to Xcode 7.2 and I am still getting the following errors with cuDNN using CUDA 7.5:

iMac:cuda-samples ssc$ make
/Developer/NVIDIA/CUDA-7.5/bin/nvcc -ccbin clang++ -I../../common/inc  -m64  -Xcompiler -arch -Xcompiler x86_64  -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_52,code=compute_52 -o asyncAPI.o -c asyncAPI.cu
/usr/include/stdio.h(133): error: expected a ")"

/usr/include/stdio.h(134): error: expected a ")"

/usr/include/stdio.h(134): error: "_Nullable" has already been declared in the current scope

/usr/include/stdio.h(135): error: expected a ")"

/usr/include/stdio.h(135): error: "_Nullable" has already been declared in the current scope

/usr/include/stdio.h(136): error: expected a ")"

/usr/include/stdio.h(136): error: "_Nullable" has already been declared in the current scope

/usr/include/stdio.h(477): error: duplicate parameter name

/usr/include/stdio.h(478): error: duplicate parameter name

/usr/include/stdio.h(479): error: duplicate parameter name

/usr/include/stdlib.h(139): error: expected a ")"

/usr/include/stdlib.h(158): error: expected a ")"

/usr/include/stdlib.h(294): error: expected a ")"

/usr/include/stdlib.h(300): error: expected a ")"

/usr/include/stdlib.h(306): error: expected a ")"

/usr/include/stdlib.h(312): error: expected a ")"

/usr/include/stdlib.h(318): error: expected a ")"

/usr/include/pthread/qos.h(113): error: expected a ")"

/usr/include/pthread/qos.h(185): error: expected a ")"

/usr/include/pthread.h(216): error: duplicate parameter name

/usr/include/pthread.h(217): error: duplicate parameter name

/usr/include/pthread.h(243): error: expected a ")"

/usr/include/pthread.h(247): error: expected a ")"

/usr/include/pthread.h(326): error: expected a ")"

/usr/include/pthread.h(340): error: duplicate parameter name

/usr/include/pthread.h(350): error: duplicate parameter name

/usr/include/pthread.h(353): error: expected a ";"

/usr/include/pthread.h(356): error: expected a ")"

/usr/include/pthread.h(493): error: duplicate parameter name

/usr/include/pthread.h(529): error: expected a ")"

/usr/include/pthread.h(540): error: variable "_Nullable" is not a type name

/usr/include/pthread.h(540): error: "pthread_t" has already been declared in the current scope

/usr/include/pthread.h(540): error: expected a ";"

/usr/include/pthread.h(543): error: duplicate parameter name

/Applications/Xcode7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/mutex(262): error: variable "pthread_t" is not a type name

35 errors detected in the compilation of "/var/folders/m1/b_t9_2151y30ryvtr_2gznch0000gp/T//tmpxft_0000a179_00000000-22_asyncAPI.compute_52.cpp1.ii".
make[1]: *** [asyncAPI.o] Error 2
make: *** [0_Simple/asyncAPI/Makefile.ph_build] Error 2

Same problem happens to me.
And I solved it with downloading the Command_Line_Tools_OS_X_10.11_for_Xcode_7.3.1.dmg and install it.
Then the clang provided by Xcode7.app will work.

BTW, My Spec is GTX-750ti under 10.12

Same problem happens to me.
And I solved it with downloading the Command_Line_Tools_OS_X_10.11_for_Xcode_7.3.1.dmg and install it.
Then the clang provided by Xcode7.app will work.

BTW, My Spec is GTX-750ti under 10.12

I am still having the following problem when running the cuDNN sample (mnistCUDNN):

iMac:mnistCUDNN ssc$ make
clang++ -c -o mnistCUDNN.o mnistCUDNN.cpp -I. -I/usr/local/cuda/include -I/usr/local/cuda/cudnn -IFreeImage/include -IUtilNPP
mnistCUDNN.cpp:405:49: error: use of undeclared identifier 'CUDNN_ADD_SAME_C'
        checkCUDNN( cudnnAddTensor(cudnnHandle, CUDNN_ADD_SAME_C,
                                                ^
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:405:49: error: use of undeclared identifier 'CUDNN_ADD_SAME_C'
./error_util.h:67:65: note: expanded from macro 'checkCUDNN'
      _error << "CUDNN failure\nError: " << cudnnGetErrorString(status); \
                                                                ^
mnistCUDNN.cpp:781:34: warning: '&&' within '||' [-Wlogical-op-parentheses]
  ...|| (argc == 2) && checkCmdLineFlag(argc, (const char **)argv, "device"))
     ~~ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mnistCUDNN.cpp:781:34: note: place parentheses around the '&&' expression to
      silence this warning
  ...|| (argc == 2) && checkCmdLineFlag(argc, (const char **)argv, "device"))
                    ^
        (                                                                   )
mnistCUDNN.cpp:446:21: error: no matching function for call to
      'cudnnSetFilterNdDescriptor'
        checkCUDNN( cudnnSetFilterNdDescriptor(filterDesc,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:676:9: note: in instantiation of member function
      'network_t<float>::convoluteForward' requested here
        convoluteForward(conv1, n, c, h, w, srcData, &dstData);
        ^
mnistCUDNN.cpp:773:24: note: in instantiation of member function
      'network_t<float>::classify_example' requested here
        int i1 = mnist.classify_example(image_name, conv1, conv2, ip1, ip2);
                       ^
/usr/local/cuda/include/cudnn.h:340:27: note: candidate function not viable:
      requires 5 arguments, but 4 were provided
cudnnStatus_t CUDNNWINAPI cudnnSetFilterNdDescriptor(
                          ^
mnistCUDNN.cpp:455:21: error: no matching function for call to
      'cudnnSetConvolutionNdDescriptor'
        checkCUDNN( cudnnSetConvolutionNdDescriptor(convDesc,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
/usr/local/cuda/include/cudnn.h:416:27: note: candidate function not viable:
      requires 7 arguments, but 6 were provided
cudnnStatus_t CUDNNWINAPI cudnnSetConvolutionNdDescriptor(
                          ^
mnistCUDNN.cpp:559:21: error: no matching function for call to
      'cudnnSetPoolingNdDescriptor'
        checkCUDNN( cudnnSetPoolingNdDescriptor(poolingDesc,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:677:9: note: in instantiation of member function
      'network_t<float>::poolForward' requested here
        poolForward(n, c, h, w, dstData, &srcData);
        ^
mnistCUDNN.cpp:773:24: note: in instantiation of member function
      'network_t<float>::classify_example' requested here
        int i1 = mnist.classify_example(image_name, conv1, conv2, ip1, ip2);
                       ^
/usr/local/cuda/include/cudnn.h:825:27: note: candidate function not viable:
      requires 7 arguments, but 6 were provided
cudnnStatus_t CUDNNWINAPI cudnnSetPoolingNdDescriptor(
                          ^
mnistCUDNN.cpp:647:21: error: no matching function for call to
      'cudnnActivationForward'
        checkCUDNN( cudnnActivationForward(cudnnHandle,
                    ^~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:683:9: note: in instantiation of member function
      'network_t<float>::activationForward' requested here
        activationForward(n, c, h, w, dstData, &srcData);
        ^
mnistCUDNN.cpp:773:24: note: in instantiation of member function
      'network_t<float>::classify_example' requested here
        int i1 = mnist.classify_example(image_name, conv1, conv2, ip1, ip2);
                       ^
/usr/local/cuda/include/cudnn.h:922:27: note: candidate function not viable: no
      known conversion from 'cudnnActivationMode_t' to
      'cudnnActivationDescriptor_t' (aka 'cudnnActivationStruct *') for 2nd
      argument
cudnnStatus_t CUDNNWINAPI cudnnActivationForward(
                          ^
mnistCUDNN.cpp:446:21: error: no matching function for call to
      'cudnnSetFilterNdDescriptor'
        checkCUDNN( cudnnSetFilterNdDescriptor(filterDesc,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:676:9: note: in instantiation of member function
      'network_t<half1>::convoluteForward' requested here
        convoluteForward(conv1, n, c, h, w, srcData, &dstData);
        ^
mnistCUDNN.cpp:840:24: note: in instantiation of member function
      'network_t<half1>::classify_example' requested here
            i1 = mnist.classify_example(image_path.c_str(), conv1, conv2...
                       ^
/usr/local/cuda/include/cudnn.h:340:27: note: candidate function not viable:
      requires 5 arguments, but 4 were provided
cudnnStatus_t CUDNNWINAPI cudnnSetFilterNdDescriptor(
                          ^
mnistCUDNN.cpp:455:21: error: no matching function for call to
      'cudnnSetConvolutionNdDescriptor'
        checkCUDNN( cudnnSetConvolutionNdDescriptor(convDesc,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
/usr/local/cuda/include/cudnn.h:416:27: note: candidate function not viable:
      requires 7 arguments, but 6 were provided
cudnnStatus_t CUDNNWINAPI cudnnSetConvolutionNdDescriptor(
                          ^
mnistCUDNN.cpp:559:21: error: no matching function for call to
      'cudnnSetPoolingNdDescriptor'
        checkCUDNN( cudnnSetPoolingNdDescriptor(poolingDesc,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:677:9: note: in instantiation of member function
      'network_t<half1>::poolForward' requested here
        poolForward(n, c, h, w, dstData, &srcData);
        ^
mnistCUDNN.cpp:840:24: note: in instantiation of member function
      'network_t<half1>::classify_example' requested here
            i1 = mnist.classify_example(image_path.c_str(), conv1, conv2...
                       ^
/usr/local/cuda/include/cudnn.h:825:27: note: candidate function not viable:
      requires 7 arguments, but 6 were provided
cudnnStatus_t CUDNNWINAPI cudnnSetPoolingNdDescriptor(
                          ^
mnistCUDNN.cpp:647:21: error: no matching function for call to
      'cudnnActivationForward'
        checkCUDNN( cudnnActivationForward(cudnnHandle,
                    ^~~~~~~~~~~~~~~~~~~~~~
./error_util.h:66:9: note: expanded from macro 'checkCUDNN'
    if (status != CUDNN_STATUS_SUCCESS) {                              \
        ^
mnistCUDNN.cpp:683:9: note: in instantiation of member function
      'network_t<half1>::activationForward' requested here
        activationForward(n, c, h, w, dstData, &srcData);
        ^
mnistCUDNN.cpp:840:24: note: in instantiation of member function
      'network_t<half1>::classify_example' requested here
            i1 = mnist.classify_example(image_path.c_str(), conv1, conv2...
                       ^
/usr/local/cuda/include/cudnn.h:922:27: note: candidate function not viable: no
      known conversion from 'cudnnActivationMode_t' to
      'cudnnActivationDescriptor_t' (aka 'cudnnActivationStruct *') for 2nd
      argument
cudnnStatus_t CUDNNWINAPI cudnnActivationForward(
                          ^
1 warning and 10 errors generated.
make: *** [mnistCUDNN.o] Error 1

Is this for real? This problem has been around for more than a year and NVIDIA has yet to solve it???

CUDA 8 has support for Xcode 8.2/clang 8.0.0
[url]CUDA Toolkit Documentation

CUDA 9 RC (registered developer download) supports Xcode 8.3.3