Page 1 of 2

Deployment & OgreRenderer

Posted: Mon Aug 02, 2010 19:50
by Akis
Hi,

I try to deploy my application (which uses CEGUI and Ogre). First, I had some problems with Ogre.

Now it's ok and it's with CEGUI that I have some problems, especially when I do this :

Code: Select all

CEGUI::OgreRenderer::bootstrapSystem()


I don't really know why, but when I try to use my installed application (after deployment), the app crash when it tries to do that. It doesn't crash when I run the application in visual studio.

All my Ogre files (resources.cfg and plugins.cfg) are in my folder in Program Files and only loggers are in the AppData folder.

Do you know why ? And what I have to do to run the application ?

Re: Deployment & OgreRenderer

Posted: Mon Aug 02, 2010 21:07
by Kulik
Please post versions of CEGUI and Ogre. Post your CEGUI.log!

I think it could be related to working directory. Visual Studio could set it somewhere whilst after deployment, it would be "./". Or perhaps permissions?

However without any more info, it's impossible to write any advice. We aren't psychics...

Re: Deployment & OgreRenderer

Posted: Mon Aug 02, 2010 21:29
by Akis
Actually, it's with Ogre 1.7.1 and CEGUI 0.7.1. But I don't have the CEGUI.log, because it's not build yet.
The very first thing I do in my GUI Engine is to run bootstrapSystem.

Re: Deployment & OgreRenderer

Posted: Tue Aug 03, 2010 11:00
by emarcotte
Do you try {... } catch (..) {...} around bootstrap? Quite often an exception is thrown and the default catching mechanism on windows isn't going to tell you all the details.

That's always the first place to start when debugging this sort of thing. More than likely, however, you have dlls in a place where its not looking for them.

Re: Deployment & OgreRenderer

Posted: Tue Aug 03, 2010 14:34
by Akis
Yeah, there is an exception, but I don't find the right one to get the reason.
I tried std::exception and CEGUI::Exception.

Re: Deployment & OgreRenderer

Posted: Tue Aug 03, 2010 15:09
by Akis
I changed the call

Code: Select all

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

by its equivalent to see how the app crashes

Code: Select all

if (CEGUI::System::getSingletonPtr())
                throw CEGUI::InvalidRequestException("OgreRenderer::bootstrapSystem: "
                    "CEGUI::System object is already initialised.");
CEGUI::OgreRenderer& renderer = CEGUI::OgreRenderer::create();
CEGUI::OgreResourceProvider& rp = CEGUI::OgreRenderer::createOgreResourceProvider();
CEGUI::OgreImageCodec& ic = CEGUI::OgreRenderer::createOgreImageCodec();
CEGUI::System::create(renderer, &rp, static_cast<CEGUI::XMLParser*>(0), &ic);

And I notice that it crashes on the last line, with the call :

Code: Select all

CEGUI::System::create(renderer, &rp, static_cast<CEGUI::XMLParser*>(0), &ic);

The problem seems to be the XML parser but I don't really know why. I don't see any exception throw in that code. And the logger was create but nothing inside except a message CEGUI::Logger singleton created. (01D0EF80)


So if i look into this method, it call new System(...). I give you the code of the function

Code: Select all

System::System(Renderer& renderer,
               ResourceProvider* resourceProvider,
               XMLParser* xmlParser,
               ImageCodec* imageCodec,
               ScriptModule* scriptModule,
               const String& configFile,
               const String& logFile)
: [....]
// Start out by fixing the numeric locale to C (we depend on this behaviour)
    // consider a UVector2 as a property {{0.5,0},{0.5,0}} could become {{0,5,0},{0,5,0}}
    setlocale(LC_NUMERIC, "C");

    // Instantiate logger first (we have no file at this point, but entries will
    // be cached until we do)
    //
    // NOTE: If the user already created a logger prior to calling this
    // constructor, we mark it as so and leave the logger untouched. This allows
    // the user to fully customize the logger as he sees fit without fear of
    // seeing its configuration overwritten by this.
#ifdef CEGUI_HAS_DEFAULT_LOGGER
    if (d_ourLogger)
        new DefaultLogger();
#endif

    Logger& logger(Logger::getSingleton());

    // create default resource provider, unless one was already provided
    if (!d_resourceProvider)
    {
        d_resourceProvider = new DefaultResourceProvider;
        d_ourResourceProvider = true;
    }

    // handle initialisation and setup of the XML parser
    setupXMLParser();

    // now XML is available, read the configuration file (if any)
    Config_xmlHandler config;
    if (!configFile.empty())
    {
        try
        {
            d_xmlParser->parseXMLFile(config, configFile,
                                      config.CEGUIConfigSchemaName,
                                      "");
        }
        catch(...)
        {
            // cleanup XML stuff
            d_xmlParser->cleanup();
            delete d_xmlParser;
            throw;
        }
    }

    // Initialise logger if the user didn't create a logger beforehand
    if (d_ourLogger)
        config.initialiseLogger(logFile);

    // if we created the resource provider we know it's DefaultResourceProvider
    // so can auto-initialise the resource group directories via the config
    if (d_ourResourceProvider)
        config.initialiseResourceGroupDirectories();

    // get config to update XML parser if it needs to.
    config.initialiseXMLParser();

    // set up ImageCodec
    config.initialiseImageCodec();
    if (!d_imageCodec)
        setupImageCodec("");

    // initialise any default resource groups specified in the config.
    config.initialiseDefaultResourceGroups();

    initialiseVersionString();
    outputLogHeader();

    // beginning main init
    logger.logEvent("---- Begining CEGUI System initialisation ----");

// [After, I don't care because I haven't that line in my cegui logger]


So, as I have a logger, I know that the problem is'nt that.
Next, I give a ResourceProvider to the method so it's not that too.

And then, there is the call of setupXMLParser(). I don't know if it's the problem, but after, there is a throw but I don't care because configFile is empty so that code is'nt executed.

Re: Deployment & OgreRenderer

Posted: Tue Aug 03, 2010 19:51
by CrazyEddie
You keep saying "crash" which is meaningless when trying to diagnose a problem. The debugger will tell you what the "crash" is (whether it's a software exception or a processor exception) - we need that information to be able to assist. Also, if it's a processor exception (such as "Access Violation" or something), post the debug callstack from the point of the exception.

Also, I see you mention CEGUI 0.7.1 and Ogre 1.7.1. You're not trying to use the old 0.7.1 prebuilt SDK are you? Because that particular issue has been done to death (i.e. we can't link against Ogre 1.7.1 in that release because Ogre 1.7.1 did not exist when the CEGUI 0.7.1 SDK was released). Please tell me it's not this issue, or I'm likely to explode...

CE.

Re: Deployment & OgreRenderer

Posted: Tue Aug 03, 2010 23:43
by Akis
Actually, it's an access violation. Here is the callstack
CEGUIBase.dll!72fa4d22()
[Frames below may be incorrect and/or missing, no symbols loaded for CEGUIBase.dll]
> msvcr100.dll!_unlock(int locknum=19) Line 375 C
msvcr100.dll!_unlock_file(_iobuf * pf=0x74622068) Line 313 + 0xe bytes C
msvcr100.dll!putc(int ch=3, _iobuf * str=0x000000c0) Line 56 + 0x6 bytes C
msvcr100.dll!putc(int ch=3, _iobuf * str=0x000000c0) Line 60 + 0x5 bytes C
msvcr100.dll!___pInvalidArgHandler() - 0xeb9 bytes C++
msvcr100.dll!_unlock_fhandle(int fh=3) Line 491 C
msvcr100.dll!_write(int fh=4452744, const void * buf=0x74582263, unsigned int cnt=8) Line 83 + 0x6 bytes C
msvcr100.dll!_flush(_iobuf * str=0x00000013) Line 154 + 0xf bytes C
msvcr100.dll!_unlock_file(_iobuf * pf=0x00ae0000) Line 313 + 0xe bytes C


CrazyEddie wrote:Also, I see you mention CEGUI 0.7.1 and Ogre 1.7.1. You're not trying to use the old 0.7.1 prebuilt SDK are you? Because that particular issue has been done to death (i.e. we can't link against Ogre 1.7.1 in that release because Ogre 1.7.1 did not exist when the CEGUI 0.7.1 SDK was released). Please tell me it's not this issue, or I'm likely to explode...

No no, I recompiled CEGUI from the sources :-)

I don't know why there is an access violation because all works fine in visual Studio 2010 (debug/release). The app crashes only when I execute it after the deployment.

Re: Deployment & OgreRenderer

Posted: Wed Aug 04, 2010 11:00
by emarcotte
I would double, triple, quadrouple check that the DLLs you're using when running in VS are the same as when not. I've done this a billion times... copy CEGUI dlls into visual studio's build directories build, test, etc then forget to copy the dlls to my 'deployment' area.

Re: Deployment & OgreRenderer

Posted: Wed Aug 04, 2010 15:44
by Akis
No no I have all CEGUI DLL into my installation folder (CEGUIBase, CEGUIExpatParser, CEGUIFalagardWRBase and CEGUIOgreRenderer)

Re: Deployment & OgreRenderer

Posted: Wed Aug 04, 2010 23:19
by Ident
Akis wrote:No no I have all CEGUI DLL into my installation folder (CEGUIBase, CEGUIExpatParser, CEGUIFalagardWRBase and CEGUIOgreRenderer)

What happens if you start it without debug (usually ctrl+F5)

Does it run?

Also did you try to execute both the debug and the release executable- both resulting in a crash?

What do the Ogre and Cegui logs say? You talked about an exception. It should be in one of those logs, if you have the logging system running. You have logs, do you? best post them here in their full extent.

Re: Deployment & OgreRenderer

Posted: Thu Aug 05, 2010 03:23
by Akis
As I said before, all works fine into Visual Studio in debug and release mode (ctrl+F5). The app runs and doesn't crashes.
If I ran directly the executable instead of into Visual Studio, all works fine too. It's only after the deployment that it crashes :-/ But I don't know why, the code is the same, the DLL are is the same folder, all seems to be the same.

But for the logs, I cannot show you more than before because there are no logs. (Actually, the only message I have into the logs is :
CEGUI::Logger singleton created. (01D0EF80)

I don't think it help you. But, I know that the app crashes between the moment where it logs this and the moment where it should log the outputLogHeader();

Re: Deployment & OgreRenderer

Posted: Thu Aug 05, 2010 09:30
by CrazyEddie
Can you get this crash with the debug build? I ask because the callstack does not help in release mode :)

Also, when you mention 'deployment', are we talking about on the same machine or a different machine?

CE

Re: Deployment & OgreRenderer

Posted: Thu Aug 05, 2010 16:41
by Akis
I can't deploy the application with the debug mode. Or I don't know how to do ^^

And yes, for now, it's only on the same computer.

Re: Deployment & OgreRenderer

Posted: Fri Aug 06, 2010 20:26
by Akis
Yeah !

I just found the problem ! :) The problem was the logger.

Because I don't want the CEGUI.log in the installation folder (and also because the app doesn't have the write rights). I changed the log filename with that :

Code: Select all

CEGUI::Logger::getSingleton().setLogFilename("My_new_cegui_log.log");

But I just saw that the logger always create a file CEGUI.log (I see that when I run the app into Visual Studio because the app can create all files it needs into the folder).

Actually, I had 2 cegui log. One with the first lines (headers), and then the others logs into my own log. After the deployment, as the app can't create the CEGUI.log into the installation folder, the app crashes.

So now, I replace all the bootstrapSystem method by its equivalent (the all code are in my older post above) and I give my own file logger to the System::create method

Code: Select all

CEGUI::System::create(renderer, &rp, static_cast<CEGUI::XMLParser*>(0), &ic, 0, "", "My_new_cegui_log.log");

It's an example because my logs are now into the Application Data folder.