LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Help installing an old version of gcc (http://www.linuxquestions.org/questions/slackware-14/help-installing-an-old-version-of-gcc-4175438707/)

animeresistance 11-25-2012 10:57 PM

Help installing an old version of gcc
 
Hello...

I'm trying to install Cuda in Slackware 14, and it needs an old version of gcc, i found this thread http://www.linuxquestions.org/questi...-a-4175434312/.

I read the instructions on how to configure and make it, but i'm not that skilled :(

Does anybody knows a simpler way to get cuda up and running?

Thank you in advance.

Cheers.

TommyC7 11-26-2012 01:48 AM

I don't use cuda, but from the advice handed down from IRC, it's recommended to install something like gcc into /opt into it's own package directory: /opt/gcc-<VERSION>.

You don't really need that <VERSION> part unless you want multiple versions of gcc in /opt. Anyways, what I would recommend is taking the SlackBuild (from Pat) and other files closest to the gcc version the program requires. Based on the thread you linked, it seems the person is using gcc-4.4.7.

Slackware 13.37 ships with gcc-4.5.2, but Slackware 13.1 ships with gcc-4.4.4. I can't guarantee gcc 4.4.7 will work with the 13.1 SlackBuild or even the 13.37 SlackBuild, but maybe you can give it a go. You never know until you try. Don't forget the other files that are also in the gcc.SlackBuild directory.

However, you should edit the SlackBuild to replace "usr" with something like "opt/gcc-$VERSION" or something. If all goes well, you have a different version of gcc installed into /opt/gcc-$VERSION/. So you'll see something like: "/opt/gcc-$VERSION/bin/gcc" or something.

Now you might be able to use:
Code:

export CC="/opt/bin/gcc-$VERSION/gcc"
Same export except with CXX instead of CC if cuda has C++ code in it.

If you don't want to do that export stuff (might forget after you're done running the script or something), you can symlink the /opt/gcc-$VERSION/bin/gcc to /usr/local/bin/gcc instead. In a default $PATH, /usr/local/bin is read before /usr/bin is so the symlinked gcc in /usr/local/bin would be used first before the newer gcc is. Although to be honest, you might forget to remove the symlink more than the export line since symlinks (in my opinion) are easier to forget. Either way, remember to remove the symlink or unset the environment variable you set with export, otherwise all of your programs will start compiling with this old gcc unless specifically told otherwise.

By the way, I said I don't use cuda and the advice I gave is what I could remember from IRC, so good luck (and I'm basically saying I gave you a fair warning ^.^ )!

guanx 11-26-2012 03:54 AM

Quote:

Originally Posted by animeresistance (Post 4836943)
Hello...

I'm trying to install Cuda in Slackware 14, and it needs an old version of gcc, i found this thread http://www.linuxquestions.org/questi...-a-4175434312/.

I read the instructions on how to configure and make it, but i'm not that skilled :(

Does anybody knows a simpler way to get cuda up and running?

Thank you in advance.

Cheers.

  1. Download proper gcc from the slackware source directory. Cuda currently supports gcc up to 4.6.x.
  2. Run the slackbuild script to build the that gcc
  3. Install that gcc
  4. Reinstall the distributed gcc (currently 4.7.1) to repair symbolic links
  5. Make symbolic links in the cuda directory, e.g. "ln -s /usr/bin/gcc-4.4.7 /usr/local/cuda/bin/gcc; ln -s /usr/bin/g++-gcc-4.4.7 /usr/local/cuda/bin/g++"

Where do you have problems in these steps?

animeresistance 11-26-2012 06:14 AM

Hi guys.

Thanks for replying ...

The problem was, that i was trying to install gcc from source, i read the index.html that explains how to configure it and install it, but got lost in the configuration files. When i configured (i think it configured), the make throwed some errors.

I will try your suggestions guys, and again, thanks for replying :)


All times are GMT -5. The time now is 12:27 PM.