linuxmacosgcc

Would GCC 4.8 and 4.7 Peacefully Coexist on the Same Machine?


Would installations of gcc 4.7 and 4.8 peacefully coexist on the same machine? This would initially be a machine with Ubuntu 12.10 (Quantal Quetzal) but may extend it to other machines and distributions later, possibly even my mac (it would be 4.8 and the last supplied apple gcc on Mountain Lion). I am trying to test gcc's improved diagnostics in 4.8 comparing them to clang's, hence my need for gcc 4.8.

How do you invoke each installation of gcc if the answer to the above is yes?


Solution

  • First off: Yes, you can have multiple installations of gcc on your machine.

    If you install gcc from the default Ubuntu repositories you can call the different versions using gcc-4.6, gcc-4.7, .... The Ubuntu toolchain test repository ubuntu-toolchain-r/test has a gcc-4.7 package. AFAIK it does not have a gcc-4.8 package yet. There exist other repositories which maintain gcc packages (even for the current 4.8 development versions; just google for ubuntu gcc repository).

    Other than that you can always also compile gcc from source ( http://gcc.gnu.org/install/index.html ) and have multiple versions ( http://gcc.gnu.org/faq.html#multiple ).