[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

How to install gcc?

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.
0
sambha03
Asked:
sambha03
1 Solution
 
Harisha M GCommented:
0
 
Harisha M GCommented:
sambha03,
    Note that if your Linux 7.0 does not support new version, you will have to switch back for an older version
0
 
sambha03Author Commented:
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
0
 
MysidiaCommented:
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    http://rpmfind.net

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...

/lib/libgcc*
/usr/lib/gcc
/usr/lib/gcc-lib
/usr/bin/gcc
/usr/bin/cpp

But these vary by distribution/GCC installation..
0
 
wesly_chenCommented:
> 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
make install   #<== this will install on the binary and libray files on /usr/local/gcc332
Then every machine (same OS) mount to /usr/local.


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now