Ubuntu 16.04 CUDA Toolkit 8RC GCC 5.4 Unsupported

I try to install CUDA Toolkit 8 RC on my Ubuntu 16.04 computer, I also installed GCC 4.9.4 on my computer. I use update-alternatives command to make GCC 4.9.4 as default compiler for whenever I install CUDA Toolkit 8 RC, GCC 5.4 will be installed together.

I have check

gcc -v

to see my gcc compiler version, it is 4.9.4. But I still get the error:

unsupported GNU version! gcc version later than 5.3 are not supported.

I also tried the method of changing the /usr/bin/gcc link to GCC 4.9.4 compiler, it still doesn’t work.

When i try to uninstall gcc5 by using

sudo apt purge gcc5

, CUDA ToolKit 8 RC will be uninstalled together.

Is there any pro can help me solve the problem? Thanks.

One possible method:

  1. Start over with a clean load of Ubuntu 16.04
  2. Download the Ubuntu 16.04 runfile installer from developer.nvidia.com
  3. Download the Ubuntu 16.04 patch installer from developer.nvidia.com
  4. Install CUDA 8RC using the runfile installer
  5. Install CUDA 8RC patch
  6. profit

The patch allows CUDA 8RC to work with gcc 5.4