I tried to compile some C code to get object file from a shell prompt:
But this gives me the following error:
/usr/ucb/cc: language optional software package not installed
How can I compile C code?
First, you should remove
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
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
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.
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.