After the last release of Xcode 9.3, the compatibility between Xcode and CUDA Toolkit 9.1 has been broken. After doing a little bit of research, Nvidia simply hasn’t updated nvcc binary executable because it’s currently linked against an older version of libSystem.B.dylib library. For example, when I try to build one of the sample applications, I’m seeing the following error message:
$ make -C 1_Utilities/deviceQuery
/Developer/NVIDIA/CUDA-9.1/bin/nvcc -ccbin clang++ -I../../common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -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_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -o deviceQuery.o -c deviceQuery.cpp
nvcc fatal : The version ('90100') of the host compiler ('Apple clang') is not supported
make: *** [deviceQuery.o] Error 1
Why I am seeing this error message?
Nvidia nvcc tool is linking against the following libraries:
$ otool -L /Developer/NVIDIA/CUDA-9.1/bin/nvcc
/Developer/NVIDIA/CUDA-9.1/bin/nvcc:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 489.0.0)
macOS actually has the following libraries:
otool -L /usr/lib/libSystem.B.dylib
/usr/lib/libSystem.B.dylib:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
...
If Nvidia simply linked against /usr/lib/libgcc_s.1.dylib, then this library would have included the correct version of libSystem.B.dylib. For example,
$ otool -L /usr/lib/libgcc_s.1.dylib
/usr/lib/libgcc_s.1.dylib:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
...
In short, nvcc is explicitly linking against /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
and macOS 10.13.4 includes /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4).
In the future, I would recommend future proofing the software that you build as much as possible for macOS by doing the following:
- not linking to a specific version of system libraries for the CUDA toolkit
- not building specific web drivers for a specific macOS build (i.e. 17D47, 17D102, 17D2047, 17D2102, or 17E199)
- build web drivers and CUDA toolkit versions which support a major version of macOS like 10.11, 10.12, 10.13, and so on
- adding much better support for searching for Nvidia web drivers on the web site for ALL platforms including macOS
- make sure that the CUDA toolkit sample code works with every release of the software
- add a nightly build process for web drivers and CUDA toolkit for ALL platforms
Ideally, it would be a benefit for the macOS and customers in general if Nvidia open sourced Nvidia CUDA toolkit and web driver code. This would allow all operating systems (OS)s including macOS to add it to their respective plaform’s build and deploy pipeline for computer hardware that supports Nvidia GPUs. Finally, I would like to recommend getting ahead of web driver and CUDA toolkit development process so people like myself isn’t waiting for Nvidia to release this critical software.