Recent Changes - Search:



My journals will take the place of a blog. They have moved to

Sites I take responsibility for






Places I frequent



Items for sale:


edit SideBar

Compiling & Developing Software on Oracle Solaris

Include our styles below Infobox - invoke as >>infobox<< ... >><<

Codebox: - invoke as >>codebox<< ... >><<

warnbox: - invoke as >>codebox<< ... >><<

editingbox: - invoke as >>codebox<< ... >><<

noticebox: - invoke as >>codebox<< ... >><<

Page bread crumbs:

Pages by tags: (:listtags:)
Subscribe to this wiki: RSS Feed RSS or subscribe to this page for changes: RSS Feed RSS
496 articles have been published so far. Recent changes
(:addThis btn="custom":)

This is now very old and applied primarily to Solaris 2.x up to Solaris 9. Also a lot of the links are now outdated but they still work.

Note: In Solaris 10 the GNU c compiler and standard libraries come on the OS Companion Software disk or can be downloaded from the link below.

If you install Sun's version of the GCC tools n Solaris 8, 9 or 10 they will install in directory /opt/sfw.

For Solaris 7, 2.6 and below:

First of all read The Solaris 2.x FAQ section 6 - Software Development, the "Goat" Book and Learning the GNU Build System. See also The Autoconf Manual and the book Autotools: A Practitioner's Guide to GNU Autoconf, Automake, and Libtool and GNU Make Unleashed.

I also recommend a knowledge of Libtool and the GNU Coding Standards.

For info on using GNU C compiler in general get the book Programming with GNU Software

I also recommend Advanced Programming in the Unix Environment.

Realize that Solaris 2.x does not come with a C compiler. Free Software Foundation's GNU Compiler Collection (gcc) is recommended. See my entry into the Sun Manager's FAQ (section 10.2) on how to do this here.

You can also download an already compiled version of gcc from

However if you need you can also purchase the Oracle Solaris Studio(tm) (used to be called Visual Workshop or Forte) a commercial development package from Sun.It contains a commercial C++ compiler.

In either case make sure you install the SUNWlibC, SUNWlibCf, SUNWlibm, SUNWlibms, SUNWscbcp, SUNWtoo, SUNWarc and SUNWhea packages as they contains the header files.

If you have loaded the SUNWbtool package you will find the /usr/ccs/bin CCS tools that are bundled with Solaris.

Check that you have installed the Oracle and GNU recommended patches.

Include the following environment variable in your login script:


Of course this needs to point to your compiler library and the actual directory will vary.

An article on why setting LD_LIBRARY_PATH is bad. But hey sometimes you have to.

The default library path is hard-linked into:

 /usr/lib/*	/usr/lib/*

Some older notes on installing gcc on Solaris here.

If you experience the following error while running configure scripts:

 checking for gcc... ccchecking whether the C compiler (cc  ) works... 
 noconfigure: error: installation or configuration problem: C compiler cannot create executables.

This means that configure is trying to use the Solaris /usr/ucb/cc compiler instead of the GNU c (gcc) compiler. To fix this make sure you have the environment variable CC defined as gcc:

 # CC=gcc;export CC


 # setenv CC gcc

There are other reasons for this error to occur. Check the output of your"config.log" file. If you see:

 configure: cc: not found

This indicates that that configure is indeed looking for the Solaris compiler.

Remember configure uses a cache. So you sometimes have to remove the cache and start over if you have made big changes to the compiler.

 # rm -f config.cache

General GNU configure errors:

It is imperitive you have the SUNWbtools package installed otherwise youwill have to install the GNU make and library tools. If SUNWbtools isnot installed you will see errors like:

 checking for ar... missing_arconfigure: error: No ar utility found.

If you wish to use the GNU make tools (and that's probably not a bad ideaanyway) you can download a pre-compiled make for Solaris from

Some additional resources which may be of help:

The Libg++ FAQ.

Using LClint for ANSI C.

Some resources for C programming.

An Introduction to C Programming.

Programming in C FAQ

A tutorial on pointers and arrays in C

Kevin's Public Wiki maintained and created by Kevin P. Inscoe is licensed under a
Creative Commons Attribution 3.0 United States License.

Back to my web site -

Edit - History - Print - Recent Changes - Search
Page last modified on March 15, 2013, at 11:20 PM EST