CUDA 4.0RC on OpenSuSE 11.3 Compiling SDK samples

I downloaded everything related to CUDA 4.0RC, the files for OpenSuSE 11.2 and started compiling the SDK samples under OpenSuSE 11.3, stymied by

error – unsupported GNU version! gcc 4.5 and up are not supported!

I then went ahead and ‘fixed’ line 81 in /usr/local/cuda64/cuda/include/host_config.h as shown below.

#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)

//#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)

Everything compiled well, except for 3 files, Interval, FunctionPointers and SobelFilter.

It would be nice, if those doing testing at NVIDIA would consider to include gcc 4.5 as a supported version. 4.5 is not exactly bleeding edge any longer.


I haven’t had time to install CUDA 4.0rc yet, but this does not surprise me at all. Everytime there’s a new version of CUDA, it’s only working with gcc <= n-1, where n is the current gcc version.

Here is what I usually do:

  • in parallel to the current gcc version (currently 4.5.2 on Arch Linux), install an older one. Right now I have 4.3.4 and 4.4.4, available as “gcc-4.3” and “gcc-4.4”.
  • for each of these old compilers, create a folder, say /opt/gcc43 and /opt/gcc44, which contain symlinks to /usr/bin/g{cc,++}-4.{3,4} that are named “gcc” and “g++” without version numbers
  • run nvcc with the --compiler-bindir option: “nvcc --compiler-bindir /opt/gcc44 $CUFLAGS …”

This has worked well so far.

But I agree, people at NVIDIA should really consider upgrading their own gcc versions. gcc 4.5.0 has been released on April 14th, 2010 – that’s almost one year! And gcc 4.6.0 is in stage 4, so it won’t be long before it is released too…

The reason for not supporting gcc 4.5 yet was laid out in another thread. gcc 4.5 switches to DWARF3 frame format, so supporting it doesn’t just involve making the toolkit and nvcc emitted code play nicely with the compiler, it involves a complete overhaul of the cuda elf and binutils and cuda-gdb as well. Right none of that will work with gcc 4.5.

NVIDIA doesn’t directly target GCC versions. They target specific Linux distributions and the default gcc that ships with them. Since the 4.0 toolkit is only tested for Ubuntu 10.10, Fedora 13, OpenSUSE 11.2, etc, they only “have” to support gcc 4.4. (In the past this was not enforced with pre-processor directives, though. Have they been getting a bunch of bug reports from people using non-standard gcc versions??)

However, I do agree it can be a little annoying that the 4-6 month release cycle of CUDA is always going to be out of phase and one step behind the 6 month release cycle of the non-enterprise distros. It does seem weird that CUDA 4.0 is still targeting OpenSUSE 11.2, when 11.3 has been out for 3 months longer than Ubuntu 10.10. That seems like an oversight, or some more interesting problem.

Thanks for this explanation. I had missed that thread, but this makes perfectly sense.

Well, I’ll keep my gcc-4.3 and 4.4 around for a little longer then :)

I’m having the same problem under Fedora 14. I tried finding an RPM package for Fedora 14 for a 4.4 version of gcc, but could only find old links that no longer linked to packages. I downloaded a package built for Fedora 13 (gcc-4.4.4-2.fc13.x86_64.rpm) and tried to install that, but got:

rpm -ivh gcc-4.4.4-2.fc13.x86_64.rpm

warning: gcc-4.4.4-2.fc13.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID e8e40fde: NOKEY

error: Failed dependencies:

cpp = 4.4.4-2.fc13 is needed by gcc-4.4.4-2.fc13.x86_64

libgomp = 4.4.4-2.fc13 is needed by gcc-4.4.4-2.fc13.x86_64

At this point, I’m afraid I’m embarking down a dependency cascade, and wonder if it wouldn’t be easier to simply install Fedora 13. Does anyone have it working under Fedora 14, and if so, can you advise? I don’t really feel up to building gcc 4.4 from source.

ETA: Went ahead and backed off to Fedora 13 and gcc 4.4.5, and everything is working for me as of May 1, 2011.

Hi there! I tried to follow your post, but I got error. What am I wrong?

sander@matrixps:~/CUDA_codes/testes$ ls -l /opt/gcc/
total 0
lrwxrwxrwx 1 root root 16 2011-08-16 14:30 g++ -> /usr/bin/g+±4.4
lrwxrwxrwx 1 root root 16 2011-08-16 14:30 gcc -> /usr/bin/gcc-4.4
sander@matrixps:~/CUDA_codes/testes$ nvcc --compiler-bindir /opt/gcc -o trivial
sander@matrixps:~/CUDA_codes/testes$ ./trivial
CUDA error: CUDA driver version is insufficient for CUDA runtime version
sander@matrixps:~/CUDA_codes/testes$ more
#include <stdio.h>

global void foo()
int main()
printf(“CUDA error: %s\n”, cudaGetErrorString(cudaGetLastError()));
return 0;
sander@matrixps:~/CUDA_codes/testes$ echo PATH /usr/local/cuda/bin:/home/sander/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games sander@matrixps:~/CUDA_codes/testes echo LD_LIBRARY_PATH /usr/local/cuda/lib64:/usr/lib32/nvidia-current: sander@matrixps:~/CUDA_codes/testes

lol, it`s a little bit offtopic, but when i trying to install PyCUDA on SLES SP1, i realized that there is no file. After all, i found that there is need in installation kernel devel rpm package before you install nvidia-devel driver. Then suddenly appears in /usr/lib64/. Or maybe this file appears after reinstalling SDK after driver.
After all PyCUDA installed.

For Suse (and pretty much the same for Fedora) please see some helpful hints I compiled at:

Under the section GCC Version Issues, which shows how to install gcc 4.5, 4.3 and configure update-alternatives for easy switching. The same applies to adding gcc 4.4