Page 1 of 1

Linux Loading Versioned Libraries

Posted: Mon Sep 30, 2013 7:07 am
by dermont
I guess this relates to the following.

http://www.ogre3d.org/tikiwiki/tiki-ind ... damonNotes
OGRE-60(external link) - Debian packaging: Allow several versions of OGRE installed at the same time

I don't see this documented anywhere but loading a library without specifying the .so extension could results in (if the library versions do not match Ogre version) the following:

Code: Select all

terminate called after throwing an instance of 'Ogre::InternalErrorException'
  what():  OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library /media/sda1/Libraries/OGRE/sdk/v1-9/lib/OGRE/Plugin_OctreeTerrainSceneManager.  System Error: /media/sda1/Libraries/OGRE/sdk/v1-9/lib/OGRE/Plugin_OctreeTerrainSceneManager.so.1.9.0: cannot open shared object file: No such file or directory in DynLib::load at /media/sda1/Libraries/OGRE/src/v1-9/OgreMain/src/OgreDynLib.cpp (line 109)

DynLib::load()

#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_NACL
        // dlopen() does not add .so to the filename, like windows does for .dll
        if (name.find(".so") == String::npos)
        {
            name += ".so.";
            name += StringConverter::toString(OGRE_VERSION_MAJOR) + ".";
            name += StringConverter::toString(OGRE_VERSION_MINOR) + ".";
            name += StringConverter::toString(OGRE_VERSION_PATCH);
        }
i.e. Plugin_OctreeTerrainSceneManager.so

Code: Select all

plugin.cfg: 
...
Plugin=Plugin_OctreeSceneManager
a) Plugin=Plugin_OctreeTerrainSceneManager
b) Plugin=Plugin_OctreeTerrainSceneManager.so
(b) loads fine, (a) wont run.

Maybe this could be documented?