In order to get CUDA SDK 4.0 to work on Fedora 14, I had to install an earlier version of GCC. This post is my notes on how I did that in the hope that if anyone else finds themselves needing to do something similar this will be of help. Apologies if I have posted it in the wrong place
Current versions of the CUDA SDK for Fedora require GCC v4.4 installed. However Fedora 14 ships with GCC 4.5 (my installation is running 4.5.4). This creates a problem if you try to install the CUDA SDK on F14 as CUDA will recognise that you are not using the specified version of GCC and will not permit you to compile any CUDA code. It returns an error message along the lines of:
To get around this, I downloaded and installed an earlier version of GCC. I didn’t want to lose the current install of the compiler, so this was an install to a non-default location with the intention being that I would switch backwards and forwards between the two installs as required. The steps I took were as follows:
Using Google I did an RPM search for GCC 4.4.4 (I went for this specific version because that is the same as the install on another machine that I also run CUDA on). I downloaded the RPM and then tried to run it, using the â€“prefix tag. However this failed with the message that the rpm package is not relocatable
I then went to http://gcc.gnu.org to download the source files in order to build and install them myself. That website gives a lot of very good installation instructions which I won’t replicate here â€“ I strongly advise anyone doing this that they read install guide on that site before trying an install themselves
Based on the installation instructions I then ran the following:
- I then got this error message:
This caused some confusion at first as I had already specified the â€“with-gmp and â€“with-mpfr options and was running GMP 4.3.1-7 and MPFR 2.4.2 however after some digging around I found this thread which told me I also needed to install the development packages to make the headers available. I installed the development packages using yum following which the configuration ran OK
I then ran the makefile using no special options, this took over an hour to complete â€“ so while it is running would be a good time to go for lunch
On completion of that I then ran make install which completed sucessfully in less than 5 minutes.
I then had a working install of GCC4.4.4. The only question which remained was how to get the CUDA compiler (NVCC) to recognise it. To do this I added the following to my .bashrc file:
- As I had added a suffix to my GCC4.4.4 install this meant that I could now invoke that compiler simply by typing â€œgcc-4.4.4â€ at the prompt instead of â€œgccâ€. This isn’t quite sufficient for NVCC so the last step was to then go into the …/GCC4.4.4/gcc/bin directory and create a symbolic link called gcc to gcc-4.4.4
It’s worth noting that by doing this, I have effectively changed the compiler for any application on my box which uses the GCC compiler to version 4.4.4. The newer version 4.5.4 is still there and to switch back to it, all I need to do is comment out the line in .bashrc detailed in step 8 above. This is sufficient for my purposes but might not be good enough for everyone.
I suspect there may be an option in the CUDA install process to specify the location of the GCC compiler that you wish to use, but I didn’t bother figuring that out as this is good enough for me. It may also be possible to dynamically switch between different compiler versions, but I don’t know how that would be done â€“ again it’s not something I need, but if anyone else figures out how to do these things and would like to share by all means please leave a reply.