| 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 |
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.
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 CCor
# setenv CC gccThere are other reasons for this error to occur. Check the output of your"config.log" file. If you see:
configure: cc: not foundThis indicates that that configure is indeed looking for the Solariscompiler.
# rm -f config.cache
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.
This site is Lynx friendly!
![]() |
![]() |
![]() |
| 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.