8

Because of program compatibility issues I need to downgrade GCC to at least 4.9

How do I do this? Thanks.

EDIT: The program is Blender and am trying to do GPU rendering. The specific error the console is kicking out is

CUDA version 7.5 detected, build may succeed but only CUDA 6.5 is officially supported.
Compiling CUDA kernel ...
"/usr/local/cuda/bin/nvcc" -arch=sm_52 -m64 --cubin "/usr/share/blender/2.76/scripts/addons/cycles/kernel/kernels/cuda/kernel.cu" -o "/home/matthew/.config/blender/2.76/cache/cycles_kernel_sm52_3A157B804910758CA7C526B5EF063D78.cubin" --ptxas-options="-v" --use_fast_math -I"/usr/share/blender/2.76/scripts/addons/cycles/kernel" -DNVCC -D__KERNEL_CUDA_VERSION__=75
In file included from /usr/local/cuda/bin/../targets/x86_64-linux/include/cuda_runtime.h:76:0,
                 from <command-line>:0:
/usr/local/cuda/bin/../targets/x86_64-linux/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
 #error -- unsupported GNU version! gcc versions later than 4.9 are not supporte
  ^
CUDA kernel compilation failed, see console for details.

Refer to the Cycles GPU rendering documentation for possible solutions:
http://www.blender.org/manual/render/cycles/gpu_rendering.html

Error: CUDA kernel compilation failed, see console for details.`
steeldriver
  • 142,475

2 Answers2

6

Like @steeldriver suggests, you need to use update-alternatives. Exactly step 3 on this question. Since at this point 4.9 is 4.9.3, which is not supported, you'll need 4.8.

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5

Remember to choose gcc-4.8 before running the installer:

sudo update-alternatives --config gcc

and after, to switch back to having gcc-5 by default.

(Since you're doing it to install the CUDA SDK, I'll add that if you want to test the samples, you may want to read this.)

ira
  • 61
1

THIS ANSWER IS DANGEROUS as it can damage your system and the GCC libraries on your system and make your system unusable. **Exercise caution when using this answer, and consider this a 'last resort' answer.

Uninstall gcc5.4

sudo apt-get remove gcc g++

Check gcc again:

gcc –version

Install gcc 4.9/g++ 4.9

sudo apt-get install gcc-4.9 g++-4.9

Checking Version:

g++-4.9 –version

Link to gcc g++

ln -s /usr/bin/g++-4.9 /usr/bin/g++
ln -s /usr/bin/gcc-4.9 /usr/bin/gcc

Checking Version:

g++ –v
gcc –v

cited from this blog, and my own install

Thomas Ward
  • 78,878
Jayhello
  • 191