This discussion is archived
5 Replies Latest reply: Apr 10, 2013 6:42 PM by Dude! RSS

upgrading to latest GCC compiler on Oracle Linux? Supported?

801904 Newbie
Currently Being Moderated
hello everyone

I have installed Oracle Linux 6.4 which includes GCC compiler 4.4.7

I would like to either (a) upgrade it to latest or (b) install newest version side by side of the latest GNU C compiler, which is at present 4.8.0.

I am only interested in the latest GNU C compiler and its related libraries (I am not trying to install/upgrade C++, Fortran, Java, etc.).

I have two questions:
(1) Is this supported to do this on Oracle Linux 6.4 or does Oracle Linux 6.4 specifically require GCC 4.4.7 ? If not supported then can I install newest GNU C side by side with older version?
(2) If supported to upgrade or install side by side, what is the easiest way for me to install or upgrade to latest GCC 4.8.0 ?

many thanks in advance
  • 1. Re: upgrading to latest GCC compiler on Oracle Linux? Supported?
    Dude! Guru
    Currently Being Moderated
    You will definitely not want to modify the GNU C compiler that is provided by the linux distribution channels. As far as I know, GNU does not provide any binary distributions. Compiling, installing and setup of gcc from source is not a trivial task and since you ask, I wonder if you should.

    For what it's worth, you can install several versions of GCC on the same machine:
    http://gcc.gnu.org/faq.html#multiple

    For installation and download see:
    http://gcc.gnu.org/wiki/InstallingGCC
    http://gcc.gnu.org/install/

    You will generally require a valid gcc and c++ compiler:
    yum install gcc gcc-c++ glibc-devel.i686 glibc-devel
    The process of compiling gcc takes several hours. The following should or might work under OL 6.4 x64:
    mkdir /home/gcc-downloads
    cd /home/gcc-downloads
    wget ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2
    
    tar -xvf gcc-4.8.0.tar.bz2
    cd gcc-4.8.0
    ./contrib/download_prerequisites
    cd ..
    mkdir objdir
    cd objdir
    $PWD/../gcc-4.8.0/configure --prefix=/usr/local/gcc-4.8.0
    make
    make install
    To use the new compiler, setting it's PATH before the standard system path might be sufficient.
    export PATH=/usr/local/gcc-4.8.0/bin:$PATH
    Here is a very trivial example to check if your gcc is working:
    cat > testls.c <<-EOF
    #include <stdio.h>
    main()
    {
    system ("ls");
    }
    EOF
    
    gcc -o testls testls.c
    
    ./testls
    gcc-4.8.0   gcc-4.8.0.tar.bz2   objdir   testls   testls.c
    To see which version of GCC was used to compile the program:
    strings -a testls | grep GCC
    GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-3)
    GCC: (GNU) 4.8.0
  • 2. Re: upgrading to latest GCC compiler on Oracle Linux? Supported?
    801904 Newbie
    Currently Being Moderated
    thank you very much Dude.

    Yes, I looked at the GNU site before posting here and I will admit to being was sufficiently scared by the process of creating the new version.

    Given that X64 Intel/AMD platform running Linux is probably the most widely used platform for GNU CC, I would have thought it makes sense for the GNU or Red Hat/Oracle folks to pre-build it for mere mortals to download, it may speed up the adoption of the new versions and improve the testing cycles....... I was hoping in vain there may be a set of RPMs for GNU CC 4.8.0 somewhere on either Oracle or Red Hat or GNU sites targeting the X64 so I don't have to build it myself 8^)

    Why does Red Hat and Oracle Linux supply such an old version of GNU as part of their latest and greatest Linux distribution? As far as I can tell the GNU 4.4 that is part of OL 6.4 is not even supported by GNU, you need at least 4.6 to be supported. It would be great if Red Hat/Oracle supplied several versions of GNU CC that could be installed and used......

    Anyhow, many thanks, case closed, I don't think its worth my time and effort to build my own GNU CC 4.8.

    Regards
  • 3. Re: upgrading to latest GCC compiler on Oracle Linux? Supported?
    Avi Miller Guru
    Currently Being Moderated
    yurib wrote:
    Why does Red Hat and Oracle Linux supply such an old version of GNU as part of their latest and greatest Linux distribution?
    It's not the latest and greatest -- it's the most stable. That's the point of an Enterprise Linux distribution: you don't want cutting edge, you want tried and trusted. If you want to be on the cutting edge, you're better off with Fedora or Ubuntu or one of the distributions that tracks the upstream packages more closely.
  • 4. Re: upgrading to latest GCC compiler on Oracle Linux? Supported?
    801904 Newbie
    Currently Being Moderated
    thanks, sure, it makes perfect sense.
    I am still wishing the Red Hat/Oracle offered an additional later version of GNU CC, in addition to the most stable version, so they could be installed side by side..... so gcc invokes the most stable version and the gcc48 or gcc47 invokes the "experimental" versions......
    But I guess this could 'open a can of support worms' for Oracle as people mix and match the GNU CC versions !!
    Can't win!!
    8^)
  • 5. Re: upgrading to latest GCC compiler on Oracle Linux? Supported?
    Dude! Guru
    Currently Being Moderated
    Later is not necessarily better or more efficient. Compiling software and updating GCC is useful for software developers who need to debug their programs or take advantage of new hardware features. It depends on requirements, such as processor support, debugging options, stability, compatibility and speed. I have never seen a production system with various verions of software compilers installed. Development software is typically not even installed on productions systems.

    GCC plays a very critical part in regard to system stability of compiled software and other programs that depend on shared libraries. It is however not a user application and not even installed by default. Compiling the system software is not part of Enterprise Linux system administration. Binary distribution packages are the standard. In most cases, when installing software that requires gcc, it's actually not compiling software, but linking object code that was already compiled, e.g. Oracle database, VirtualBox guest additions, etc.

    Compiling the kernel, which was common practice in Linux 20 years ago, is no longer standard and usually going to jeopardize support by the vendor.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points