Monday, December 17, 2012

How to install GCC in linux


Important messages about GCC:

GCC version :     $ gcc -v
gcc path  :  $which gcc
If you are using Red Hat Enterprise Linux, type the command:

# up2date gcc
If you are using CentOS/Fedora Core Linux, type the command:

# yum install gcc

Some important GCC commands :
$ which gcc
/usr/bin/gcc

$ whereis gcc
gcc: /usr/bin/gcc3.2-version /usr/bin/gcc /usr/local/bin/gcc /usr/share/man/man1/gcc.1.bz2 /usr/share/man/man1/gcc.1

$ gcc -v
Reading specs from /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/specs
Configured with: /usr/local/src/gcc-3.3.1/configure –prefix=/usr –libdir=/usr/lib –with-slibdir=/lib –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –enable-long-long –enable-__cxa_atexit –enable-languages=c,c++,ada,f77,objc,java –host=i586-mandrake-linux-gnu –with-system-zlib
Thread model: posix
gcc version 3.3.1

$ gcc –version
gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



Install GCC in linux:
su -
passwrd:
mkdir /usr/local/src
cd /usr/local/src
gunzip /tmp/gcc-3.3.1.tar.gz #where I downloaded the file
tar xvf /tmp/gcc-3.3.1.tar
cd /opt/build
/usr/local/src/gcc-3.3.1/configure
–prefix=/usr –libdir=/usr/lib –with-slibdir=/lib –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –enable-long-long –enable-__cxa_atexit –enable-languages=c,c++,ada,f77,objc,java –host=i586-mandrake-linux-gnu –with-system-zlib


make
make install

No comments:

Post a Comment