Your script installs ossim-core and libossim-dev, this is not a good idea. These are pretty old. When you call from the command line without specifying which OSSIM you're talking about (the built one or the package) you can get very frustrated if you change your built version and nothing seems to be changing!
I would turn off the predator plugin unless you plan on using it (for UAV video). Remove anything that has to do with Kakadu. You are right, this is a $ library. I don't believe that OSSIM has another way of reading in JPEG2000 unless GDAL supports it. We don't typically build the plugins that I mention to turn off below. Jpeg support can come from the GDAL plugin.
Remove: DKAKADU_LIBRARY, DKAKADU_AUX_LIBRARY, DKAKADU_ROOT_SRC
Turn off: DBUILD_OSSIMREGISTRATION_PLUGIN, DBUILD_OSSIMOPENJPEG_PLUGIN, DBUILD_OSSIMPREDATOR, DBUILD_OSSIMCONTRIB_PLUGIN
Turn on: DBUILD_OSSIMGDAL_PLUGIN
Rebuild OSSIM. If the package for GDAL isn't working with your machine, I've downloaded gdal and compiled it successfully many times.( http://trac.osgeo.org/gdal/wiki/DownloadSource ) version 1.7.3 should work. I haven't tested the latest version.
OSSIM can open TIF and NITF
OSSIM_PLUGIN = SAR imagery types
GDAL_PLUGIN = Everything else
As for the segfault. I think it comes from mismatch in what you're building with versus running with. Just incase, could you send the cpp (You may have dereferenced a null pointer on accident)?
We've seen seg faults on linux when using jpeg images in opencv. We've found png to be more stable. There may be a conflict with the jpeg you've installed from apt-get and the one that opencv is using. If your simple program is opening the same image with the same function as the complex one, then that rules out jpeg problem though.
Bryan