[solved] ms_singleton error

DigitalBilby

02-08-2008 04:13:19

Alright I'm having problems here, I have searched the various topics but not found the solution. It's centered around the ms_singleton assert error.

According to the information I've been able to find this is caused when the code links to both a debug and a release version of a library. Can anyone explain what is going wrong here and how I could fix it?

The code:
import ogre.renderer.OGRE as Ogre

class MyLog(Ogre.LogListener):
def __init__(self):
Ogre.LogListener.__init__(self)

def messageLogged(self, message, level, debug, logName):
pass


logMgr = Ogre.LogManager()

myLog = MyLog()

currentLog = Ogre.LogManager.getSingletonPtr().createLog("test.log",
True,
False,
False)
currentLog.addListener(myLog)

root = Ogre.Root()


I'm using the Ubuntu package found on the mailing list.

The error I get:
python: OgreLogManager.cpp:44: static Ogre::LogManager& Ogre::LogManager::getSingleton(): Assertion `ms_Singleton' failed.
Aborted

SomeFusion

02-08-2008 07:39:27

I think you will have to create OgreRoot before anything else. OgreRoot then initializes the LogManager for you.

dermont

02-08-2008 09:18:24

Your error message shows that you are trying to output to a log/LogManager which doesn't exist.

Since you are allowing python to do automatic garbage collection it may be that your log/logMgr is deleted before root. Ogre.Root still writes to the log during it's destruction.

Try manually deleting root, at the end of your program:

del root

chpod

02-08-2008 10:19:13

Could you please rename you post ms_singleton assert error, please?

Thx,
chpod

DigitalBilby

02-08-2008 11:51:42

Thanks for the suggestions. del root at the end worked.

Changed the topic so it can be effectively searched and added solved as the above solution worked.

nkosinathi

19-02-2009 17:27:35

Hello,

I'm using python-ogre for academic purposes and am still a bit unfamiliar with everything, so please bear with my probably mundane question:

I'm getting the same error as DigitalBilby, and adding del root to the end of HIS example solved the problem, however none of the Demos work for me and the tutorial code isn't fixed with that as well (or I'm doing it wrong, which is not entirely unlikely):


import ogre.renderer.OGRE as ogre
import SampleFramework as sf

class TutorialApplication(sf.Application):

def _createScene(self):
pass

if __name__ == '__main__':
ta = TutorialApplication()
ta.go()


give me:

(...)
MovableObjectFactory for type 'RibbonTrail' registered.
Loading library /usr/lib/OGRE/RenderSystem_GL.so
python: OgreRoot.cpp:100: static Ogre::Root& Ogre::Root::getSingleton(): Assertion `ms_Singleton' failed.
Aborted


Could you please briefly elaborate on the issue so that I can understand how to solve the problem in general? I'm running Debian.

andy

20-02-2009 00:36:55

Are you using Python-Ogre built from source or one of the binary packages?

What error do you get when running demos (Demo_Smoke for example)..

Thanks
Andy

nkosinathi

20-02-2009 13:00:52

Hi Andy,

thanks for the quick reply. I'm using the binaries as provided by the website. However I don't have root access to the system, so if compiling the libraries myself is the only option I'll have to wait for our admins to do that (other people in the lab need python-ogre too, so a local installation is no real option either.)

Anyway, this is what running Demo_Smoke.py (and any other Demo as well as the code I posted above) produces:

...@dopamine:~/test/demos/ogre$ python Demo_Smoke.py
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
FreeImage version: 3.10.0
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
DDS codec registering
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
Loading library /usr/lib/OGRE/RenderSystem_GL.so
python: OgreRoot.cpp:100: static Ogre::Root& Ogre::Root::getSingleton(): Assertion `ms_Singleton' failed.
Aborted



Any ideas?

nkosinathi

27-02-2009 15:48:26

Btw, could you remove the "solved" flag? A colleague of mine is having the same problem in another lab...

andy

01-03-2009 00:39:20

Can you let me know what the environment etc is that you are seeing this problem -- the previous issues were resolved so I'm assuming that you have something new here...

Sorry in advance if you've already answered some of this and I missed it...

* Can you run the prebuilt binaries and do they have the issue.
* What unix are you using
* etc

Thanks
Andy