Fork me on GitHub

OpenSolaris -- Part X

written on April 12, 2009

I have OpenSolaris 2008.11 installed on an external HDD, and boot it up from time to time, when there is some time to loose.

Today, I went over to NVIDIA Developers area and grabbed the Solaris version of the Cg Toolkit, which is a nice Solaris package, installs and works flawlessly under OpenSolaris, except the example programs won't compile because of the evil GLUT.

I tried to compile GLUT 3.7, but after 2 hours of pain I gave up, and installed the freeglut which is available in the Blastwave repo. In the next few lines I will illustrate how to get one of the samples compiling and working with freeglut without much pain.

The best way to go is to copy the examples directory into your home directory or desktop for convenience. I will modify the examples/OpenGL/basic/26_toon_shadding sample program.

First we need to edt 26_toon_shading.c in order to change the "GL/GLUT.h" include to "GL/freeglut.h", and after this modifying the Makefile.

First of all I added :

CFLAGS += -I"/opt/csw/include"

This is required because the Freeglut package will install there, and modified CLINKFLAGS by appending -L/opt/csw/lib so it looks like this:

CLINKFLAGS += -L/usr/X11R6/lib64 -L/usr/X11R6/lib -L/opt/csw/lib

After this, a regular 'make' will do the job, but when running the executable there will be an error saying that the freeglut shared object cannot be found. This is fixed by prepending the /opt/csw/lib to the LD_LIBRARY_PATH environment variable with the following shell command:

export LD_LIBRARY_PATH=/opt/csw/lib:$LD_LIBRARY_PATH

... there you go :D up and running.

screen

Personally, I think that it's an good idea installing all the 3rd party stuff inside the /opt dir instead of /usr or /usr/local, which seems to be a common practice in the existing Linux communities, of course this is more or less a matter of tastes.

"Gustibus non, disputatum est."

PS: can't wait for the native Skype port, especially for OpenSolaris :D