dev-util/nvidia-cuda-toolkit cannot be used with gcc 4.5 and up. As such, one has to keep a version of gcc 4.4 or lower installed. If >=4.5 is selected with gcc-config, then the cuda compiler "nvcc" cannot compile anything: "error -- unsupported GNU version! gcc 4.5 and up are not supported!" A workaround is to use the --compiler-bindir option to nvcc: $ nvcc --compiler-bindir /usr/x86_64-pc-linux-gnu/gcc-bin/4.4.5 ... but this puts the burden to every user of the machine. I'm looking for a solution/workaround system-wide. According to http://stackoverflow.com/questions/6622454/cuda-incompatible-with-my-gcc-version creating symbolic links in cuda folder pointing to the right gcc will make it work. I tested it here and it works: # for f in /usr/x86_64-pc-linux-gnu/gcc-bin/4.4*/*; do ln -s $f /opt/cuda/bin/`basename $f`; done This allows keeping 4.5 (or others) as the active gcc version while using 4.4* for cuda only. Could dev-util/nvidia-cuda-toolkit's ebuild include such a workaround? That might make it easier... Thanks. Reproducible: Always
With cuda 4.1, this is no longer necessary. And actually, using this breaks nvcc, the cuda compiler.
This is handled now with the new cuda.eclass as far as we can. We shouldn't workaround nvidias gcc version restrictions.