1

I am using CentOS 5.6 which have gcc 4.1.2 installed. I want to additionally install gcc 4.4.6. So, basically I want to install it as a second gcc, and not upgrade the previous one (that is, I want to keep it). What is the simplest way to do so?

MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
  • 1
    http://stackoverflow.com/a/7834049/643500 its for Ubuntu, but it should work for you – Sully May 03 '12 at 17:42
  • Is this the same box as your other question, where you do not have root access? – Chris Stratton May 03 '12 at 17:55
  • No I do have root access on this one. Will configure, make, make install do? In configure though I will have to prescribe a separate directory, such as --prefix=directory. – MetallicPriest May 03 '12 at 18:04
  • Yes, the only serious issue with root is that most distribution's package system for installing pre-built programs from the distribution only works for root, and insists on putting the package files in fixed, system-wide locations. But you can build something from source for yourself and set an install location under your home directory. Binaries distributed separately from a linux distro are often more flexible too. – Chris Stratton May 03 '12 at 18:37
  • The really tricky part in my opinion is getting a new GCC to use the currently installed libgcc and libstdc++ libraries. If you don't, you will be always limited to running your compiled programs on only that one machine. – Zan Lynx May 03 '12 at 20:05

4 Answers4

1

Just install gcc and the various libraries in a separate directory. Create a script to update the various environment variables (you will need to source this) to set the shell to use the appropriate version as required.

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
  • Yes, but most of the challenge is probably figuring out what exactly to install - a compatible but generic binary tarball? Build it from generic or distribution source? Install a distribution package, somehow convincing it to go in an alternate location? (FYI poster has a related question which seems to indicate they do not have root on the box - would have been good if that were mentioned explicitly here) – Chris Stratton May 03 '12 at 17:54
  • @ChrisStratton - Any of the above will work. Perhaps a tarball is the simplest in this case. – Ed Heal May 03 '12 at 17:58
0

You will generally need the gcc package itself, ideally a dedicated version of glibc, and then binutils (and perhaps more), and you will need to install them all to a common prefix.

You may want to look into projects such as buildroot as well (for a pre-made solution), or 'Linux From Scratch' which explains the process of building your normal toolchain).

Mark Nunberg
  • 3,551
  • 15
  • 18
0

yum install gcc44 did it for me!

MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
0

follow these steps, I have tested them and worked correctly for me (Install alternative version of gcc)

P_0
  • 163
  • 2
  • 7