Home > Geek stuff > Sun Resources > Developing Software on Solaris http://ke3vin.org/geek/sun/compilesun/
Last updated: 179 day(s) ago (Sun Feb 24 15:01:34 2008) Thu Aug 21 13:07:37 2008
Compiling & Developing Software on Sun Solaris 2.x

Compiling & Developing Software on Sun Solaris

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.

See Sun's link about this.

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 theSolaris 2 Porting FAQ, The Solaris 2.x FAQ section 6 - Software Development, the "Goat" Book and Learning Autoconf and Automake.

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

For info on using GNU C compiler in general get the bookProgramming with GNU Software
I also recommend Advanced Programming in the Unix Environment.

Relealize 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 fromhttp://sunfreeware.com.

However if you need you can also purchase the Sun Studio(tm) (used to be called Visual Workshop or Forte)
a commercial development package fromSun.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 GNU and Sun recommended patches

Include the following environment variable in your login script:

LD_LIBRARY_PATH=/usr/lib:/usr/openwin/lib:/opt/gnu/lib:/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3

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/ld.so.*	/usr/lib/libld.so.*
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 compilerinstead of the GNU c (gcc) compiler. To fix this make sure you have theenvironment variable CC defined as gcc:
# CC=gcc;export CC
or
# 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 Solariscompiler.

Other kinds of problems such as libg++ issues can be resolved by reviewingthe install notes for MySQL under section 2.12.3. Solaris Notes.

Remember configure uses a cache. So you sometimes have to remove the cacheand 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 eitherhttp://sunfreeware.com.

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.

C Programming Self Study Course.

Yahoo's C & C++ Directory

Programming in C FAQ

A tutorial on pointers and arrays in C

Please send comments (and corrections :^) ) and updates, etc.. to kevin@inscoe.org

Sitemap:

[ Home | My professional site | Sig | Blogs | Podcasts | Where is Kevin? | Contact | Resume | More about Kevin ]
[ Geek | Weather | Radio | Aero | Electronics | Trains | GPS | Music | Travel | Movies | For sale | Photos ]
[ Mailing Lists | Quotes | Looking for a job? | Cheap gas? | Public files | Links | Changes ]
[ Inscoe Family | The Volt Company | Yellow Twister Hosting | Refuge Software ]
[ Central Florida Geeks | Central Florida Unix Professionals ]

Why are these pages black?

This site is Lynx friendly!

Current time in Deltona, Florida, United States [28.9002N 81.2419W | Grid: EL98jv] is Thu Aug 21 13:07:37 2008


Copyright © 1995-2005 Kevin P. Inscoe Viewable With Any Browser

This website and all original artwork and material is © copyright 2005 Kevin P. Inscoe. Other material is used under the "Fair Use" provisions of United States of America Copyright law, and all rights remain with the original copyright holders.