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

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

How to install gcc 2.7.2 in Solaris ?

I tried to install gcc 2.7.2.2 (x86). But it not works ("installation problem, cannot exec 'cpp' : No such file or directory"). Why? I copied gcc...tar.gz into /usr/local and ungzipped/untared. Also I copied all files into /usr/pkg/gcc-2.7.2/. May be I made something wrong?

0
vb138ff
Asked:
vb138ff
1 Solution
 
df020797Commented:
The problem is if you dont have buyed the SParc Works Compiler from Sun that you dont have a compielr to build gcc with. B ut dont fear. On ftp://ftp.darkface.pp.se/pub/sun do you find the package FSFgcc.gz and a gunzip to decompress it with. Then run pkgadd -d./FSFgcc and install that precompiled compiler. Its installed in /opt/gnu. NOW you got a compiler. Download the latest gcc and untar it. Then in the gcc directory run a ./configure (make sure /opt/gnu/bin is first in your path). After that run make. After that run 'make stage1' and after that run 'make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"', then run make stage2 and then run 'make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"' and then run as root 'make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"'. Take /opt/gnu/bin out of your path and try the new compiler out. If it works run pkgrm and deinstall the FSFgcc package. You should then have a brand new working gcc

Regards
//Patrik
0
 
yakovlevCommented:
Probably, you have an already precompiled compiler. Check the
subdirectory "lib/gcc-lib" in your main GCC directory, then
goto it and search for another subdirectory, name of which
resembles your operating system (it's "sparc-sun-solaris2.5" on
my machine), then goto it and search for a subdirectory,
name of which is equal to GCC version (it's "2.7.2.2" on
my machine). This last subdirectory usually contains all the
parts of GCC, and you should use option -B to say the compiler,
where to search its parts. For example, insert the following
lines in your makefile:

  CC = ${GCCHOME}/gcc
  CFLAGS += -I${GCCHOME}/include -B${GCCHOME}/

and do the following command in your C-shell:

  setenv GCCHOME ${YOURGCCDIR}/lib/gcc-lib/<YourOS>/2.7.2.2

Of course, you can use a different name instead of GCCHOME.
Pay attention to "-I" option and last slash in "-B" option -
they are important. And this method doesn't require to have
GCC on your search path.

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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