Cuda 5.0 + gcc 4.7.2 + opencv 2.4.3

Hi all,

I’m configuring my project to work on a gpu-cluster. I’m facing a big problem, OpenCV 2.4.3 needs gcc 4.7.2 to run but cuda 5.0 does not run if using gcc 4.7.2.
Any suggestions/help?

Thank you all,


The reason CUDA 5.0 does not work with gcc 4.7 is because in the header file “host_config.h” a check is made on the gcc version. If it is anything above gcc version 4.6, it will define an error and compilation will stop. I had the same problem with CUDA 4.0 and gcc-4.6. What worked for me is to just comment out the gcc version check in host_config.h.

I’m not sure that is the “only” reason. Having say that it’s absurd that 4.8 is out and still 4.7 isn’t supported having lot of distributions out there shipping 4.7 by default.

In some cases, the header check is the only reason. NVIDIA only does QA testing on the compilers that are standard on the specific Linux distribution versions they support. To prevent people from having unexpected results on versions of GCC that have not been tested, they put that version test into the header file. If you comment it out, you are basically acknowledging that there is no warranty and you are on your own. That’s not a big deal, but be prepared. :)

The general issue of lagging compiler support is mostly due to CUDA’s slow release schedule and the time that NVIDIA spends on QA testing. When a new CUDA release comes out, it typically was tested only on the distribution releases that were available about 6-8 months before the CUDA release date. This is why the latest “officially” supported version of Ubuntu is 11.10. Since GCC 4.7 wasn’t made the default compiler until Ubuntu 12.10, GCC 4.7 won’t be supported in CUDA until Ubuntu 12.10 is supported, and who knows whether 12.10 made the cut for the next CUDA release.

(I’m not saying I like this, but I figured I would at least explain the existing process.)