How to install gcc?

Posted on 2005-04-23
Last Modified: 2013-11-13
I have a gcc version installed when I log in to machine A. However I need another version of gcc on machine A. I have copied over the gcc folder contianing the new version of gcc  from machine B. How do I install it now? I am no linux redhat version 7 or so.
Question by:sambha03
    LVL 37

    Expert Comment

    by:Harisha M G
    LVL 37

    Expert Comment

    by:Harisha M G
        Note that if your Linux 7.0 does not support new version, you will have to switch back for an older version

    Author Comment

    I copied over the directory from another machine on the same OS and added it to path and set LD_LIBRARY_PATH. Things seem ok.

    then i type gcc --version I get the new version. Does this mean everything is ok or am I supposed to actually compile gcc from source code?

    teh folder does not contain any configure file as pointed in link by mgh_mgharish
    LVL 23

    Expert Comment

    Running configure  and make refers to building from source, but you seemed to copy
    binaries over.

    It's best to not just copy binaries over directly: I wouldn't recommend that approach
    if it can be avoided, but instead install using an RPM, that way GCC will be in the
    typical location, and you can continue to update, maintain, verify the packages
    using the RPM package manager.

    Your distribution vendor should provide RPMs for GCC on the same medium you
    installed the system with,  or try

    If you just copy binaries over or compile from source (by unpackaging a .tar.gz
    rather than say, by building a binary RPM), now you've lost the advantages RPM
    provided you of easy update/addition/removal/verify/management of the
    software's installed files.

    It is indeed possible in some cases to install on the second system by copying
    binaries over, if the OSes are otherwise the same... the files related to GCC from
    one matching directory to the others...

    Provided the proper versions of binutils libc, etc are installed on the target system

    Some relevant directories/files may be found in...


    But these vary by distribution/GCC installation..
    LVL 38

    Accepted Solution

    > copied over the directory from another machine on the same OS
    Then it should be ok since there are the same OS.
    I have mounted /usr/local from NFS server for every machine with the same OS.
    I installed multiple version of GCC on /usr/local, i.e. /usr/local/gcc322, /usr/local/gcc332, /usr/local/gcc343.
    Then I do
    ln -s /usr/local/gcc322/bin/gcc  /usr/local/bin/gcc322
    ln -s /usr/local/gcc332/bin/gcc  /usr/local/bin/gcc332
    ln -s /usr/local/gcc343/bin/gcc  /usr/local/bin/gcc343

    So, when I need to use certain version of gcc (say gcc332), I can use /usr/local/bin/gcc332 or re-link
    ln -s /usr/local/gcc332/bin/gcc  /usr/local/bin/gcc

    Since those machines' OS are the same, so I don't need to recompile for every machine.
    Just compile the source code on one machines with
    ./configure --prefix=/usr/local/gcc332
    make install   #<== this will install on the binary and libray files on /usr/local/gcc332
    Then every machine (same OS) mount to /usr/local.


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now