Pages

Tuesday, April 20, 2010

Installing gcc compiler on Solaris 10

1 Installing gcc compiler on Solaris 10
1.1 Extract Packges
After downloading create and move files to the directory /download and gunzipped them
bash-3.00# cd download
bash-3.00# gunzip gcc-3.4.6-sol10-x86-local.gz 
bash-3.00# gunzip libiconv-1.11-sol10-x86-local.gz

1.2 Install libiconv package
After that installed the libiconv package first, since that is a requirement.
bash-3.00# pkgadd -d libiconv-1.11-sol10-x86-local

Select package(s) you wish to process (or 'all' to process all packages).
(default: all) [?,??,q]: all


Do you want to install these conflicting files [y,n,?,q] y


1.3 Install gcc-3.4.6-sol10-x86-local
bash-3.00# pkgadd -d gcc-3.4.6-sol10-x86-local.gz

Select package(s) you wish to process (or 'all' to process all packages).
(default: all) [?,??,q]: all


Do you want to install these conflicting files [y,n,?,q] y  


1.4 Check gcc installation
bash-3.00$ gcc -v



1.5 Install & test GNU "make"
1.5.1 Extract and check
bash-3.00# gzip -d make-3.81-sol10-x86-local.gz 
bash-3.00# head make*

1.5.2 Install make into /usr/local/bin:
bash-3.00# rlogin localhost -l root (optional if you're already root)
bash-3.00# cd /download
.bash-3.00# pkgadd -d make-3.81-sol10-x86-local


1.5.3 Test the installation: 
bash-3.00# /usr/sbin/pkgchk -d make* SMCmake


1.6 Set class path
Add class path to .cshrc or .profile file
path= /bin/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/lib:/usr/ccs/bin:/usr/local/bin:/usr/bin: /usr/sfw/bin:$path

Note : check with ‘# env’ to make sure the PATH you enter is active

2 Test GCC and GMAKE
2.1 Test GCC
To test GNU "gcc" on a simple C src program
bash-3.00# mkdir /tmp/test 
bash-3.00# vi /tmp/test/hello.c #include main() { printf("Hello world.\n"); return 0; }

bash-3.00# gcc /tmp/test/hello.c -o /tmp/test/hello.exe
bash-3.00# /tmp/test/hello.exe


2.2 Test gmake
To test GNU "gmake" using a simple Makefile
bash-3.00# vi /tmp/test/Makefile


bash-3.00# cd /tmp/test 
bash-3.00# gmake hello 
bash-3.00# ./hello