CUDA 7.5 installation: Unsupported compiler error

Amir picture Amir · Jan 8, 2016 · Viewed 24.3k times · Source

I just tried installing CUDA 7.5 on my laptop. I disabled lightdm and did sudo sh cuda7.5.run. The driver installation passed but then I got an error Unsupported compiler ... and the installation fails. How can I resolve this issue?

Answer

Martinez Mariano picture Martinez Mariano · Jun 3, 2016

I had a similar issue installing CUDA 7.5 in Ubuntu 16.04.

I've solved it using gcc/g++ 4.8 instead of 5.2.

You can install it and switch the default version using the command update-alternatives --install

For gcc 4.8 do:

sudo apt-get install gcc-4.8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10

For g++ 4.8 do:

sudo apt-get install g++-4.8
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10