How to install gcc on Solaris?

Posted on 2003-02-26
Medium Priority
Last Modified: 2013-12-21
I am running solaris 8 and I would like to install gcc. After reading the installation notes at http://gcc.gnu.org/install, I still don't understand how to do it.

I have added the package for libgcc. After pkgadd the gcc libraries, I have no clue how to proceed. I am not sure besides the libraries, what other packages I need to add as I could not find the gcc compiler.

Could someone provide me with a simple step by step instruction on how to install gcc and how to perform a simple compile using gcc?

I also have a C++ compiler /opt/SUNWspro. Will the installation of gcc has any impact on the C++ compiler?

Please be patient with me I am new to compiling C++ in unix.
Question by:rosetalk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Otetelisanu earned 400 total points
ID: 8024225
1. Load from sunfreeware.com gcc compiler
2. unzip the file
3. pkgadd -d <name from file>
4. PATH=$PATH:/usr/local/bin
5. gcc file.c

the compilername  gcc is in /usr/local/bin


Expert Comment

ID: 8025605
Yeah, I've had issues with compiling gcc on Solaris boxes in the past.  After my ump-teenth try I decided it may be better to just pkgadd the darn thing.  You can get a Solaris gcc pkg from sunfreeware.com, www.freeware4sun.com, and even http://www.ibiblio.org/pub/.  Don't forget to check the versions on the pkgs as sometimes they lag from the most recent version out there.

--- M

Author Comment

ID: 8027140
I have downloaded gcc-3.2.2-sol8-sparc-local.gz and it is about 273MB. This package includes the GNU C, C++, g77, Java, and OBJC compiler suites and support files. I don't want to install so many things. Are they neccessary? Are there any downloads with only the gcc compiler.

There is this statement in the gcc-3.2.2 comments that says "To use the gcc package from sunfreeware.com you MUST install all of the SUNW deveoper packages that come on Sun's Solaris CDs."

I did not installed the Sun developer packages in my server and I can't afford to them because of disk space constraint.

Please advise. Thanks.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8027537

Expert Comment

ID: 8047450
My advise would be to get the gcc package from http://www.sunfreeware.com/.  You'll find any dependancies listed there along with detailed installation instructions.

Once you've installed that package, I'd recommend getting the gcc source and building from scratch.

Anyway, thats my 2cents.
- Pogga.
LVL 18

Expert Comment

ID: 10425968
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by  Otetelisanu

Please leave any comments here within the next four days.


EE Cleanup Volunteer

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 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