Installing GCC 4.4 on Fedora 14 to use CUDA SDK 4.0
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
Newer 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:
1) 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<dir> tag. However this failed with the message that the rpm package is not relocatable
2) 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 the install guide on that site before trying an install themselves
3) I downloaded gcc-4.4.4.tar.gz from a GNU.org mirror (see GNU.org for details) and unpacked it into the directory I had already created for it (here on called GCC4.4.4)
4) Based on the installation instructions I then ran the following:
6) 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
7) On completion of that I then ran make install which completed sucessfully in less than 5 minutes.
8) 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:
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.
|All times are GMT -5. The time now is 07:28 PM.|