Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This posting aims to document how go about getting a development host on Solaris.

A "development host" is one where you have all the appropriate tools to build and compile C or C++ applications.

Putting development tools such as a compiler onto a host significantly increases the attack surface of that host so in my opinion you shouldn't have them on hosts that face the outside world. They also take up some disk space.

share|improve this question

1 Answer 1

There are two possible C/C++ compilers available for Solaris.

  • GNU C/C++. This is the compiler most often used on Linux. It is often referred to as 'gcc'. It is first class compiler and is available for both Solaris on SPARC and Solaris on X86. Once installed this compiler is always executed using the gcc command.

  • Solaris Studio. This is Oracle's own compiler. It was previously called Sun Studio. Some say that it will produce faster code than gcc especially on SPARC. If you choose this compiler prepare for some warnings when you compile someone else code. This is because most code these days has been developed using the gcc compiler and the gcc compiler lets the C/C++ developer get away with more dirty tricks without flagging them as such. The Solaris Studio compiler on the other hand is a lot more chatty about what is sees as bad or even non-standard coding style. Just ignore such warnings from Solaris Studio compiler. Back many, many years ago this compiler would cost you money. Today it is a free download from Oracle under the "Oracle Solaris Studio OTN Developer License Agreement" which - although not a totally "free" license" - won't be limiting for 99.9% of users. Once installed this compiler is always executed using the cc command.

For most cases the GNU C/C++ compiler is just fine and is all you need.

Solaris 10

GNU C/C++

It is already installed but it lives in /usr/sfw/bin. The most common mistake people make is to assume it is not installed because they can't find it on their PATH. Make /usr/sfw/bin part of your PATH after your other elements on your PATH.

Solaris Studio

It is not installed by default. Follow the instructions found here. You do not have to be root in order to install it.

Other

GNU make is also installed by default in Solaris 10. It too lives in /usr/sfw/bin and is called gmake.

Solaris 11

GNU C/C++

It is not installed by default. By far the easiest is to use IPS to install it using the commands below (while being root or other superuser):

pkg install pkg://solaris/developer/build/gnu-make
pkg install pkg://solaris/developer/build/make
pkg install pkg://solaris/developer/gcc-45
pkg install pkg://solaris/system/header
pkg install pkg://solaris/developer/build/autoconf
pkg install pkg://solaris/developer/build/automake-110

This will give you all the tools you typically need to build various open source software packages.

Note that some of the packages have a version number in the package name itself, e.g. gcc-45. You may be able to find even later versions in the package repository, for example for Solaris 11.2 Beta you'll find you have a choice of GCC 4.5, 4.7 or 4.8. The same applies to automake which is now also available in v1.11.

Solaris Studio

It is not installed by default. Follow the instructions found here. You can choose to to install via IPS (the easiest I think, although it does require you to add another IPS repository as well as a certificate ... all of which is documented on the link). You can also install via a tarball in which case you do not have to be superuser.




General recommendations when building software packages on Solaris

So you grabbed a software package from the Internet and now want to build it on Solaris ? Here are some general recommendations:

  • Always use GNU tar to unpack, don't use Solaris' own tar. So do gtar xf foo.tar rather than tar xf foo.tar or whatever. Yes in 99.99% of the cases Solaris' tar will work just fine for you but there are some subtle differences between the two for example if the tar file contains soft links.

  • Use GNU make rather than Solaris' make For example when you are told to do this: make all then instead do MAKE=gmake gmake all.

  • You will generally have less trouble using GNU C/C++ to build rather than Solaris Studio because chances are that the makefiles and the compile options etc have only been tested with GNU C/C++ compiler.

  • Probably more to add to this list. Keep those comments coming.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.