LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 09-15-2011, 07:45 AM   #1
stuart_m
LQ Newbie
 
Registered: Oct 2010
Location: Glasgow, UK
Distribution: Fedora
Posts: 14

Rep: Reputation: 1
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:

Quote:
#error -- unsupported GNU version! gcc 4.5 and up are not supported!
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:

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:
Quote:
../gcc-4.4.4/configure –prefix=../GCC4.4.4/gcc --program-suffix=-4.4.4 --with-gmp=/usr/lib/ --with-mpc=/usr/lib/ --with-mpfr=/usr/lib/
5) I then got this error message:
Quote:
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.0+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.
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 that 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

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:

Quote:
PATH="../GCC4.4.4/gcc/bin:$PATH"
export PATH
9) 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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CUDA on fedora 15 bxsjc Linux - General 2 07-30-2011 06:48 AM
Installing CUDA SDK on Fedora stuart_m LinuxQuestions.org Member Success Stories 0 02-21-2011 05:43 AM
problems with CUDA 3.0 64 bit install, drivers and SDK eulering Linux - General 0 06-08-2010 01:22 AM
errors when installing amd sdk 1.1 on fedora 9 anushka Fedora 2 07-26-2008 04:20 AM
Help installing Java sdk/jdk 6 on Fedora core 6 tecksk8er001 Linux - Software 13 05-21-2007 06:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 04:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration