Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to compile some C code to get object file from a shell prompt:

$cc a.c  

But this gives me the following error:

/usr/ucb/cc:  language optional software package not installed

How can I compile C code?

share|improve this question
What version of Solaris? Copy-paste the output of uname -a. Either you don't have a compiler or it's not in the default PATH; ask your admins. If you don't have a Sun compiler (or even if you have one), you can install GCC, possibly from a Sun software distribution. – Gilles May 6 '11 at 14:01

First, you should remove /usr/ucb from your PATH as this directory is quite obsolete now. It was meant to ease people migrating from SunOS 4 to Solaris 2 a couple of decades ago but doesn't make much sense these days. Especially this cc commands which set specific flags to compile BSDish code.

Second, all current Solaris releases comes with a C compiler out of the box but it is located in a directory which might not be in your PATH, /usr/sfw/bin and is named gcc (Gnu compiler). Note that Solaris 11 has gcc in the PATH.

On Solaris 10, use




Alternatively, you might have already installed (or you can install) the Solaris Studio compiler (now Oracle Developer Studio). In that case, its path would be <installation-dir>/bin/cc (eg: /opt/SUNWspro/bin/cc, /opt/SolarisStudio11/bin/cc, /opt/OracleDeveloperStudio12.5-OS-sparc-bin-bin/developerstudio12.5/bin/cc, etc.)

share|improve this answer
How do we install the Sun Studio compiler rather than using GCC. We catch occasional bug reports for SunCC, but a fresh install of Solaris 10 only produces the message discussed in the question. For completeness, we are OK with the gear for Sun Studio 12.2 and above; we need Sun Studio on Solaris 10. Also see How to find past downloads after "Sun Download Center Changes" – jww Jul 8 at 20:07
@jww Isn't this already answered here unix.stackexchange.com/a/194196/2594 ? – jlliagre Jul 8 at 20:27
Thanks Jlliagre. That's Sun Studio 12.5. Were interested in Sun Studio for Solaris 10. The cited answer and its link if for Sun Studio 12.5, which is for Solaris 11. – jww Jul 8 at 20:49
@jww Not only Solaris 11. There are download links for Oracle Solaris 10 (SPARC and x86) SVR4 installers. – jlliagre Jul 8 at 20:57
Thanks again Jlliagre. How to find past downloads after "Sun Download Center Changes" states its effectively one of the those dead-end webmaster loops that results in a non-download. Its very frustrating. – jww Jul 8 at 20:59

It is unfortunate that sun ever shipped /usr/ucb/cc; you would think it was compatible with SunOS 4; instead it compatible with some very old version of 4.2 but it also required the installation of the SunPro (Now Solaris Studio) compilers.

These compilers can be downloaded from


under the following license terms (quoted from the above page)

Provides perpetual no-cost license for production use and the development of commercial applications.

share|improve this answer

Your Solaris installation doesn't have a compiler installed. Back in the 1900:s, Sun charged extra for their C compiler, and provided a stub "cc" command instead, just to remind you that the compiler is not installed.

To compile a file, you need to install a compiler for the same Solaris version (2.5.1?) and architecture (SPARC/sun4m?) that matches your operating system and computer hardware.

Read more at SunFreeware.com for free software that installs under /usr/local/.

If you take that open source/GNU road, you will probably need to install a lot of packages to satisfy dependencies before it works, but if you have the disk space it would probably be worth it.

Old versions of Sun's SparCompiler/Forte/SunStudio can be hard to obtain for your (supposedly) old machine, as they were typically licensed with node locked licenses, and you will not be able to buy a license for those obsoleted software packages any more.

share|improve this answer
This cc isn't a stub command to remind the compiler is not installed but was designed to ease recompiling code written for SunOS 4 (BSD) on Solaris 2 (System V). – jlliagre May 6 '11 at 14:45
/usr/ucb/cc: language optional software package not installed – MattBianco May 10 '11 at 8:12
It does indeed report that situation but my point was /usr/ucb/cc isn't "just a stub command designed to remind the compiler isn't installed" but a command with a different and specific purpose. – jlliagre May 10 '11 at 9:00

Your Answer


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.