Ramblings of a Deranged Mind
To C or not to C? (part 3)
So I've finally managed to get my C compiler working. (yay, the crowd goes wild!)
Needless to say my opinion is that this was harder than it needed to be for an operating system that is aimed at the open source developer community, especially if the intent was to lure developers over to OpenSolaris, encourage and foster the development of applications on OpenSolaris, and to grow the OpenSolaris community.
Nevertheless, I am here and one of the suggestions from readers of my blog is to document the process that I went through to get things going so that others may benefit from it, so here goes.
After installing OpenSolaris, you will need a few more packages to enable you to write C and C++ applications. The commands that you need are listed below, any mistakes, let me know.
$ su - root # pkg set-authority -O http://blastwave.network.com:10000/ blastwave # pkg list -a
At this point you should see a long list of packages scrolling on your screen. Packages beginning with IPS are from the blastwave repository and those beginning with SUNW are from the OpenSolaris repository. The reason for adding the blastwave repository is that there are some packages that aren't available yet on the OpenSolaris repository.
# pkg install SUNWhea SUNWarc IPSgcc3
The line above installs the C header files and the standard libraries in /usr/include that all compilers need, whether you are using gcc or Sun Studio. These files are not included with the compilers so you have to install them separately.
The choice of compilers are either IPSgcc3 or IPSgcc4core, which you choose depends on the compatibility of your source code and which features you prefer.
# export PATH=/opt/csw/bin:/opt/csw/gcc3/bin:/usr/gnu:$PATH
The final step is to update the PATH variable with the new locations, and away we go! I hope this has been useful for some of you.
Comments?
Posted at 12:40AM Jan 07, 2009 by samktan in IT | Comments[0]
Wednesday Jan 07, 2009