Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have tried Googling for my answer, but everyone is saying GCC is already installed on the Solaris Operating System. They said to add /usr/sfw/bin to your $PATH, which I did, and rebooted the machine, but still nothing happened, when I tried compiling my software using GCC.

But when I do the following find command as the root user:

find / -name gcc

I get no results returned. That to me indicates there is no GCC installed on this system.

Where can I get it from and install it on the system?

Note: This is not on SPARC but on VMWare.

share|improve this question
    
type gcc on command line & plz paste the output here.... –  raghav mishra Feb 22 '13 at 12:25
    
SPARC or x86 makes no difference. There is no need to reboot after modifying the PATH environment variable. What Solaris version is it (cat /etc/release) and who installed it ? –  jlliagre Feb 22 '13 at 12:56
    
@raghavmishra so I just type gcc? i.e. it will look like this: $ gcc? - OK, I did that and it says: -bash: gcc: command not found –  Kevdog777 Feb 22 '13 at 13:06
    
@jlliagre it is Oracle Solaris 11.1 X86 and I installed it. –  Kevdog777 Feb 22 '13 at 13:07
    
@raghavmishra: After installing GCC using pkg install gcc-45, I typed gcc in the command line, and it now shows gcc: no input files - thank you guys :-) –  Kevdog777 Feb 22 '13 at 13:28
add comment

2 Answers

up vote 2 down vote accepted

After a little more research, I have found that I can use

pkg install gcc-45

and now that is busy downloading. I was weary of using that, as in the other Linux machines, you can't use pkg.

Thanks for looking and trying to help me solve this, but I think it is sorted now.

share|improve this answer
1  
It is unclear if you are aware of this or not but in any case, Solaris is not a Linux distribution so has its own way(s) to install packages (just like you won't do it the same way on say Ubuntu, Red Hat or Slackware). –  jlliagre Feb 22 '13 at 13:23
    
Oh ok, no I didn't know that. Thank you. I am still very new at UNIX. :-) –  Kevdog777 Feb 22 '13 at 13:26
1  
OK, what happens is just that the package wasn't installed. Find out how to check what packages are installed, and what is available (I've not used Solaris in more than 10 years, so I'm no help there). Consider carefully what else you might need. –  vonbrand Feb 22 '13 at 21:58
add comment

The advice you got about where to find gcc relates to Solaris 10, not Solaris 11. You have already learned that for Solaris 11 you need to install a package called gcc-45 but that isn't enough.

Here's the list GNU packages that I believe should exist on any Solaris system:

Just execute as follows:

pkg install pkg://solaris/archiver/gnu-tar
pkg install pkg://solaris/developer/gnu-binutils
pkg install pkg://solaris/diagnostic/top
pkg install pkg://solaris/file/gnu-coreutils
pkg install pkg://solaris/file/gnu-findutils
pkg install pkg://solaris/text/gawk
pkg install pkg://solaris/text/gnu-diffutils
pkg install pkg://solaris/text/gnu-grep
pkg install pkg://solaris/text/gnu-sed

(no, I understand you didn't really ask for this but having them available will make your life easier down the road)

Here's what you asked for: If you use the host for development/build purpose you should add:

pkg install pkg://solaris/developer/build/gnu-make
pkg install pkg://solaris/developer/build/make
pkg install pkg://solaris/developer/gcc-45
pkg install pkg://solaris/system/header
pkg install pkg://solaris/developer/build/autoconf
pkg install pkg://solaris/developer/build/automake-110

(just installing gcc-45 isn't enough)

The above will give you a host with all the traditional GNU/Linux tools and the traditional tools for C/C++ development that are typically used by various open source packages during the build/compile process.

The GNU tools take up very, very little disk space so really no reason not to install them IMHO. The dev tools take up a bit more so you can leave them out on hosts where you don't want to do build/compile.

share|improve this answer
    
Thanks for that, but I got it to work with just that gcc-45, all I need is that compiler. –  Kevdog777 Feb 28 '13 at 8:57
    
ok, then you are in luck. I needed at least the headers (system/header) –  nolan6000 Feb 28 '13 at 13:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.