The Linux Page

Installing Solaris to compile your software

Now a day I like to install Solaris to check that my code compiles and generally runs under that OS.

I think that's a good way to prove that the code is multi-OS ready even if it is only for Unices.

OpenSolaris is free and can be downloaded from Oracle. The last URL I use was:

https://www.oracle.com/solaris/solaris11/downloads/solaris-downloads.html

The system, by default, comes with a directory named /usr/sfw which includes a really old version of gcc. It is possible, though, to move forward with a newer version of the compiler by installing a package. Under Solaris 11.2, this is done with:

sudo pkg install gcc-c++-48

The list of available packages can be determined using the search command:

pkg search g++

and you will get a list of packages in link with g++. Only installing g++ will also install gcc since it depends on it.

The search may give you a list of very specific versions (with an @ character and the version information) which can be specified to install that very version.

Now I also mainly use git so I install that package too in order to retrieve the source files of my projects:

sudo pkg install git

I'm sure you could also install svn and cvs if you are using those type of repositories still.

Finally, I use cmake to create the Makefile that works at once:

sudo pkg install cmake

And I'm ready.