Can't make samples after installation

I installed CUDA 8.0 on my Ubuntu 16.10 X86_64 system. I followed the Quick Start Guide instructions for the .deb installation. I updated the PATH and LD_LIBRARY_PATH as directed. I then tried to build the nbody sample code and got the error that the GCC compiler version 6.2 was not supported, so after searching for a solution I commented out the line the raised the version error. Now, when I try to build make stddef.h will not compile:

johann@mars:~ cd ~/NVIDIA_CUDA-8.0_Samples/5_Simulations/nbody johann@mars:~/NVIDIA_CUDA-8.0_Samples/5_Simulations/nbody make
/usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I…/…/common/inc -m64 -ftz=true -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_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o bodysystemcuda.o -c bodysystemcuda.cu
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h(436): error: identifier “nullptr” is undefined

/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h(436): error: expected a “;”

/usr/include/x86_64-linux-gnu/c++/6/bits/c++config.h(205): error: expected a “;”

/usr/include/c++/6/exception(63): error: expected a “;”

/usr/include/c++/6/exception(69): error: expected a “;”

/usr/include/c++/6/exception(77): error: expected a “;”

/usr/include/c++/6/exception(85): error: expected a “;”

/usr/include/c++/6/exception(95): error: expected a “{”

/usr/include/c++/6/bits/exception_ptr.h(64): error: function “std::current_exception” returns incomplete type “std::__exception_ptr::exception_ptr”

… and on and on…

Help?

Ubuntu 16.10 is not an officially supported linux distribution for CUDA 8.

http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements

The line that triggered the error is there for a reason as you have discovered, and commenting it out is not a valid solution as you have discovered.

The correct solution is to use a supported linux distribution.

If you want to try and make this work, you can try installing an older (supported) version of gcc (e.g. 5.3.1) and using that, but I wouldn’t be able to give you instructions for that, however if you search around you’ll find many tutorials.

So I need to rollback an entire Linux distribution upgrade to get CUDA to work? Not very practical. Plus, CUDA depends on an obsolete compiler version (obsolete by many months) - presumably it depends on deprecated or no longer supported compiler features? This sounds like a pretty big bug. I would hope that NVIDIA is working to fix this? In any event, is there a workaround? I can’t believe I am the only Linux user who has this problem.

New CUDA versions generally support newer operating systems (and drop support for older operating systems).

I would expect any new OS support (and/or new compiler support) to appear in a future CUDA release, based on past experience. Not any time before that, based on my experience. I can’t predict the future of course.

Since the behavior is documented under the system requirements section I already listed, this would not be considered a bug by NVIDIA. It is expected behavior, and the error check you defeated is further evidence of that. This sort of interlock between CUDA versions and host compiler versions has been present since day 1 of CUDA, at least for use of the CUDA runtime API and associated syntax.

Regarding workarounds, I already mentioned the only one I am familiar with. Install an older gcc toolchain on your Ubuntu 16.10 box and use that with CUDA. Installing a particular version of gcc toolchain on linux is a topic covered in many articles in many places.

Sorry, I was working on answers found on stack overflow. Still, hard coding compiler version dependencies such that a newer compiler version cannot be used seems to be “problematic” to say the least. I would hope that NVIDIA would be a bit more concerned with the customer experience. Things should just work.