Friday, May 9, 2008

SDL_image is such a difficult child...

The past two days or so I've finally started doing some real coding with OpenSolaris, more in the hopes that I'd finally actually get some WORK done, but also with the intention of figuring out how well the system would perform with compilation and whatnot. This morning I spent a lot of the day installing a few minor tools as well, and have been making attempts to get everything running together.

The first task was to install GCC (which is an industry standard and, as I mentioned, should be included with a base install, but I'm not going to split hairs) using pkg install gcc-dev. Whoo, now I have gcc/g++.

Second, installing nano. I know plenty of people live or die by vi/emacs/whatever, but I have had nothing but trouble with vi every time I try to use it, so I went with the little baby text editor (had to install from source).

Third...and hardest...getting SDL_image to link with my program. The biggest issue I'm running into using this system is the fact that things are installed in /usr/local/whatever, while everything else is installed in /usr/whatever. Just adding them to the $PATH in .bashrc worked for a few things, and I managed to get everything to compile without a hitch, but running was a whole new bag of fish.

Every time I try to run it, I get "SDL_image library not installed, die immediately" errors. Unfortunately I couldn't seem to figure out where to add the library path...not as simple as adding an include path here and there.

Enter crle. Apparently this little utility is used to modify the library search path. I read over the man page a little bit, then tried to add the search path using the command crle -l /usr/local/lib...Bad. Idea. Read here, this is exactly what happened.

So, long story short, ultimate fail. Fortunately I'm no stranger to re-installation. Hopefully more updates later, once my world is fixed.


I took the opportunity afforded me by a full reinstall to give my system a little more room to breathe, with an upgrade to a full 35 GB HDD space (the main reason I wiped rather than just resetting everything as outlined in the above website). After doing this I read the above linked page (VERY carefully) and managed to set the correct load paths:

#crle -u -l /usr/local/lib

The paths can be verified with the following command:


This is an odd quirk of Solaris, but of course the OS can't be blamed for silly mistakes I made in configuration. For the most part, with enough knowledge and google skills, getting comfortable with a new system's details really isn't too painful, though sometimes huge screw-ups are unavoidable.

Finally, my compilation:

$g++ -o Play `sdl-config --cflags --libs` -lSDL_image -L/usr/local/lib

Followed by:


Unfortunately there are still bugs to be worked out...but for now I'm just happy to have made progress to the point where I can run things :P

No comments: