Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 398683

Summary: Workaround for dev-util/nvidia-cuda-toolkit and gcc 4.4
Product: Gentoo Linux Reporter: Nicolas Bigaouette <nbigaouette>
Component: [OLD] DevelopmentAssignee: Justin Lecher (RETIRED) <jlec>
Status: RESOLVED WORKSFORME    
Severity: minor    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Nicolas Bigaouette 2012-01-12 17:19:46 UTC
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
Comment 1 Nicolas Bigaouette 2012-02-01 00:10:25 UTC
With cuda 4.1, this is no longer necessary. And actually, using this breaks nvcc, the cuda compiler.
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2013-01-14 07:39:30 UTC
This is handled now with the new cuda.eclass as far as we can. We shouldn't workaround nvidias gcc version restrictions.