/usr/ucb/cc: language optional software package not installed
Solution 1
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 come 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
/usr/sfw/bin/gcc
or
PATH=$PATH:/usr/sfw/bin
gcc
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.)
Solution 2
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
http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html
under the following license terms (quoted from the above page)
Provides perpetual no-cost license for production use and the development of commercial applications.
Solution 3
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.
Related videos on Youtube
user7164
Updated on September 18, 2022Comments
-
user7164 over 1 year
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?
-
Admin about 13 yearsWhat version of Solaris? Copy-paste the output of
uname -a
. Either you don't have a compiler or it's not in the defaultPATH
; 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.
-
-
jlliagre about 13 yearsThis 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).
-
MattBianco about 13 years/usr/ucb/cc: language optional software package not installed
-
pengwynn almost 8 yearsHow 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"
-
jlliagre almost 8 years@jww Isn't this already answered here unix.stackexchange.com/a/194196/2594 ?
-
pengwynn almost 8 yearsThanks 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.
-
jlliagre almost 8 years@jww Not only Solaris 11. There are download links for Oracle Solaris 10 (SPARC and x86) SVR4 installers.
-
pengwynn almost 8 yearsThanks 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.
-
jlliagre almost 8 years@jww Do you mean you are unable to download either of these Solaris 10 tarballs?