CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

cjsandow
Just popping in
Just popping in
Posts: 4
Joined: Sat Oct 23, 2010 14:11

CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby cjsandow » Sat Oct 23, 2010 14:28

I've installed the CEGUI precompiled SDK for the Mac, and have set up a project to include it. Everything compiles fine, but when I come to initialising the CEGUI system:

Code: Select all

mGUI = &CEGUI::OgreRenderer::bootstrapSystem();


...I get an error relating to the Expat parser:

Code: Select all

CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error
terminate called after throwing an instance of 'CEGUI::GenericException'
  what():  CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error


It looks similar to http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3255, but I don't understand the solution that was given there! :(

cjsandow
Just popping in
Just popping in
Posts: 4
Joined: Sat Oct 23, 2010 14:11

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby cjsandow » Sat Oct 23, 2010 21:37

Ok, I noticed (belatedly) the PluginBundles folder, so I added them into the project. It now gets far enough to actually produce a CEGUI log:

23/10/2010 22:22:56 (Std) ---- Version 0.7.4 (Build: Oct 11 2010 Apple Mac g++ 4.0.1 (Apple Inc. build 5494) 32 bit) ----
23/10/2010 22:22:56 (Std) ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
23/10/2010 22:22:56 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
23/10/2010 22:22:56 (Std) ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
23/10/2010 22:22:56 (Std) ---- Scripting module is: None ----
23/10/2010 22:22:56 (Std)
23/10/2010 22:22:56 (Std) ---- Begining CEGUI System initialisation ----
23/10/2010 22:22:56 (Std) CEGUI::ImagesetManager singleton created (0x1c7d070)
23/10/2010 22:22:56 (Std) CEGUI::FontManager singleton created. (0x1c7fd10)
23/10/2010 22:22:56 (Std) CEGUI::WindowFactoryManager singleton created
23/10/2010 22:22:56 (Std) CEGUI::WindowManager singleton created (0x1c7fde0)
23/10/2010 22:22:56 (Std) CEGUI::SchemeManager singleton created. (0x1c828a0)

There's nothing else in the log, but the debug console reports the actual error:

/Users/paul/dev/SDKs/OgreSDK-1.7.1/boost_1_42/boost/thread/pthread/recursive_mutex.hpp:67: failed assertion `!pthread_mutex_lock(&m)'

Yes, that's raised by the Boost library, and yes, it's coming from the Ogre SDK, but as the program previously worked, and as adding CEGUI is the only change I've made, I'm assuming that this is being triggered by something to do with CEGUI. Actually, given that I missed the bundles folder, I imagine it's quite possibly because there is something else that I should be including in the project ... but I don't know what that might be...

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby Kulik » Sat Oct 23, 2010 21:50

Are you developing a multithreaded app? If so, are you initialising CEGUI in the same thread as Ogre?

cjsandow
Just popping in
Just popping in
Posts: 4
Joined: Sat Oct 23, 2010 14:11

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby cjsandow » Sat Oct 23, 2010 22:08

Nope, but good point. I've just had a quick hunt through my code, in case I'd accidentally done something which made the app think it was multi-threaded (I'm a bit new to Ogre, CEGUI, and Xcode...), but it's a fairly simple intro app, and I can't see anything -- I do the standard Ogre setup stuff (create the root, window, camera, etc), then initialise CEGUI.

I think I'll have a look through the CEGUI source (I'm using the precompiled SDK, but I've downloaded a copy of the source as well), and see if I can figure out at what point the error is being triggered.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby Kulik » Sat Oct 23, 2010 22:25

The error is that the recursive mutex fails to lock... You are probably doing something wrong when initialising. Would you mind to paste the code?

cjsandow
Just popping in
Just popping in
Posts: 4
Joined: Sat Oct 23, 2010 14:11

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby cjsandow » Sat Oct 23, 2010 22:40

Yep -- I've traced it through to the createVertex method of Ogre's hardware buffer handling (which gets called from CEGUI's MouseCursor class) -- this attempts to lock the buffer.

This is my initialisation code -- it's a bit lengthy, I'm afraid. The actual CEGUI stuff is at the end.

Code: Select all


{
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
    mResourcePath = Ogre::macBundlePath() + "/Contents/Resources/";
#else
    mResourcePath = "";
#endif
   Ogre::String wndTitle = "MainApp v1.0";

   // Create a log to output debug messages to.
   new Ogre::LogManager();
   mLog = Ogre::LogManager::getSingleton().createLog("OgreLogfile.log", true, true, false);
   mLog->setDebugOutputEnabled(true);
   mLog->logMessage("MainApp() log started");
   
   // Specify the location of the plugins configuration file.
   Ogre::String pluginsPath;
   pluginsPath = mResourcePath + "plugins.cfg";

   // Create a root Ogre instance.
   mRoot = new Ogre::Root(pluginsPath, mResourcePath + "/ogre.cfg");
   mLog->logMessage("Ogre::Root created");

   // Show the configuration dialog
   if(!mRoot->showConfigDialog())
      mLog->logMessage("MainApp() start-up failed");
   else
      mLog->logMessage("MainApp() start-up completed successfully");
   
   // Create the main window. Everything else will run inside this window.
   mWindow = mRoot->initialise(true, wndTitle);
   
   // Setup the basic scene elements -- the manager, the camera, and
   // the viewport.
   mScene = mRoot->createSceneManager(Ogre::ST_GENERIC, "SceneManager");
   mScene->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));
   
   mCamera = mScene->createCamera("Camera");
   
   mCameraHeight = 20.0;
   mCamera->setPosition(Ogre::Vector3(0, mCameraHeight, 0));
    mCamera->lookAt(Ogre::Vector3(0, 0, -100));
    mCamera->setNearClipDistance(0.1);
    mCamera->setFarClipDistance(50000);
   
    if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
    {
        mCamera->setFarClipDistance(0);   // enable infinite far clip distance if we can
    }
   
   mViewport = mWindow->addViewport(mCamera);
   mViewport->setBackgroundColour(Ogre::ColourValue(0.8, 0.7, 0.6, 1.0));
   
   mCamera->setAspectRatio(Ogre::Real(mViewport->getActualWidth()) / Ogre::Real(mViewport->getActualHeight()));
   
   mViewport->setCamera(mCamera);

   // Set up the input system
   unsigned long hWnd = 0;
    OIS::ParamList paramList;
    mWindow->getCustomAttribute("WINDOW", &hWnd);
   
   paramList.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
   
   mInputMgr = OIS::InputManager::createInputSystem(paramList);
   
    mKeyboard = static_cast<OIS::Keyboard*>(mInputMgr->createInputObject(OIS::OISKeyboard, true));
   mKeyboard->setEventCallback(this);
   
   mMouse = static_cast<OIS::Mouse*>(mInputMgr->createInputObject(OIS::OISMouse, true));
   
   mMouse->getMouseState().height = mWindow->getHeight();
   mMouse->getMouseState().width = mWindow->getWidth();
   mMouse->setEventCallback(this);

   // Read the Configuration file, extracting the file paths, and
   // adding them to the ResourceGroupManager.
   Ogre::String secName, typeName, archName;
   Ogre::ConfigFile cf;
    cf.load(mResourcePath + "resources.cfg");
   
   Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
      Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
            // OS X does not set the working directory relative to the app,
            // In order to make things portable on OS X we need to provide
            // the loading with it's own bundle path location
            if (!Ogre::StringUtil::startsWith(archName, "/", false)) // only adjust relative dirs
                archName = Ogre::String(Ogre::macBundlePath() + "/" + archName);
#endif
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
        }
    }
   
   Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
   Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

   mMoveSpeed      = 0.1;
   mRotateSpeed   = 1.0; //0.3;

   mWindow->setActive(true);
   
   // Initialise the GUI.
   CEGUI::OgreRenderer& mGUI = CEGUI::OgreRenderer::bootstrapSystem();
   
   CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
   CEGUI::Font::setDefaultResourceGroup("Fonts");
   CEGUI::Scheme::setDefaultResourceGroup("Schemes");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
   CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
   
}



EDIT: I thought I'd found it, when I noticed that bootstrapSystem() returns a reference, not a pointer, so I amended my code (as above) to take a reference instead. It doesn't make any difference to the problem, though... :(

littlepig
Just popping in
Just popping in
Posts: 6
Joined: Fri Nov 05, 2010 09:09

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby littlepig » Fri Nov 05, 2010 09:17

Hi guys

eeheheh, I have the same problem here with the same specs. So, I decided to delete the complex bootstrapSystem() and use simpler functions:

Code: Select all

printf("olaaolalalala11111 \n");
   CEGUI::OgreRenderer& m_pRenderer = CEGUI::OgreRenderer::create();
   printf("olaaolalalala22222 \n");
   CEGUI::System::create(m_pRenderer);
        printf("olaaolalalala33333 \n");


this code is inside the ogreframework.cpp, that was created using an ogre template for mac. So, in my app, I have a [copy frameworks] build phase, where I copy the "CEGUIBase.framework" and "CEGUIOgreRenderer.framework", and in the end I link them to the exec.

After I run it, I get:

Code: Select all

olaaolalalala11111
olaaolalalala22222
CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error
terminate called after throwing an instance of 'CEGUI::GenericException'
  what():  CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error


I tried with this code: http://www.ogre3d.org/tikiwiki/Practical+Application&structure=Tutorials and it gave me the same bug:

Code: Select all

CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error
Last edited by littlepig on Sat Nov 06, 2010 08:40, edited 1 time in total.

littlepig
Just popping in
Just popping in
Posts: 6
Joined: Fri Nov 05, 2010 09:09

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby littlepig » Fri Nov 05, 2010 20:27

In this post: http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&t=3255 it is mentioned the same problem. The solution was changing the XML parser or undefine the CEGUI_DEFAULT_XMLPARSER. So, I assume I must go to the CEGUIConfig.h (inside the framework), and change this

Code: Select all

#ifndef CEGUI_DEFAULT_XMLPARSER
#   define CEGUI_DEFAULT_XMLPARSER ExpatParser
#endif

to (disable the CEGUI_DEFAULT_XMLPARSER)

Code: Select all

//#ifndef CEGUI_DEFAULT_XMLPARSER
//#   define CEGUI_DEFAULT_XMLPARSER ExpatParser
//#endif

or, (change parser)
#ifndef CEGUI_DEFAULT_XMLPARSER
# define CEGUI_DEFAULT_XMLPARSER XercesParser
#endif[/code]
or any other parser. Unfortunately this didn't work. Any hints on where am I doing wrong?

littlepig
Just popping in
Just popping in
Posts: 6
Joined: Fri Nov 05, 2010 09:09

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby littlepig » Tue Nov 09, 2010 08:39

Hi.

I searched in almost source available, and I don't see any answer. :|

In my xcode project, I copy the frameworks CEGUIBase and CEGUIOgreRenderer to the app, along with ogre frameworks. I have the gui.zip file, and I'm doing exactly as it is said in the basic application topic. Yet,

Code: Select all

SceneManagerFactory for type 'TerrainSceneManager' registered.
CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error
terminate called after throwing an instance of 'CEGUI::GenericException'
  what():  CEGUI::GenericException in file /Users/paul/dev/cegui/sdk-build/CEGUI-0.7.4/projects/Xcode/../../cegui/src/CEGUIDynamicModule.cpp(128) : DynamicModule::DynamicModule - Failed to load module 'CEGUIExpatParser': Unknown Error

keeps coming.

What is the XMLparser? do I have to have it from other place else? why is CEGUI not finding it?

thanks,
littlepig

littlepig
Just popping in
Just popping in
Posts: 6
Joined: Fri Nov 05, 2010 09:09

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby littlepig » Tue Nov 09, 2010 09:00

Ok, FINALLY I did it!!!

One needs to add the bundles to the project, under plugins. That will make this work...
/Applications/OgreSDK/CEGUI-SDK-0/PlugInBundles/Release

(I'm not who created this topic, but for me is [SOLVED] )

cheers,
littlepig

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: CEGUI 0.7.4 & Ogre 1.7.1 on Mac OSX 10.6.4

Postby Jamarr » Tue Nov 09, 2010 13:49

Thanks for posting the solution littlepig. I am not a mac developer so I could not comment on this. I knew the error message pointed to the linker being unable to find the xml parser library, but I've no idea how to correct that for a mac build. I'm sure others will find this information useful.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests