Page 1 of 1

[SOLVED] Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 15:16
by Anasky
Hello everyone,

I finally managed to get CEGUI working locally, and as a result commited the cegui code, libs, and dlls onto subversion and had another colleague test it.
However, as he did so, he got a runtime exception at the first call to CEGUI.
We tried to recreate the dll files of CEGUIBase-0_d.dll and CEGUIOpenGLRenderer-0_d.dll, which resulted in his version working.
I can't imagine this to be the only way of solving this issue though. This same issue occurs in both debug and release, and having every person who would play the game having to create the dll files would be impossible to ask.

So, my question is, how can we use 1 single dll creation to support all (windows) devices?

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 15:53
by Ident
Yes one creation is enough. This has been done in games on the market so yes.

You did not tell us what exactly the error is though. What is it?

Did you distribute all needed runtime DLLs with your executable?

did you compile CEGUI in the same configuration (respectively for the version either in debug/release + same toolset) as your application?

Have you used the dependency walker to see what it says is wrong?

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 16:06
by Anasky
The error we're getting is rather undescriptive unfortunately...
"Unhandled exception at 0x0.... in ...exe: Microsoft C++ exception: CEGUI::GenericException at memory location 0x0..."

I distributed the 2 dlls of CEGUIBase-0_d.dll and CEGUIOpenGLRenderer-0_d.dll ; as well as freetype_d.dll, glew_d.dll, glfw_d.dll, jpeg_d.dll, libexpat_d.dll, libpng_d.dll, pcre.dll, SILLY_d.dll, and zlib_d.dll.

Yes, I did compile them at the right configurations. Both Debug and Release, both Win32 and x64, are working on my pc locally. None of them are working for him.

Unfortunately, I'm not aware of what the dependency walker is, although I imagine if the exact same folder works for me, then it should be having the appropriate dependencies, even when moving it to his pc?

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 16:15
by Ident
There are the microsoft VC++ runtime dlls also involved, as well as potentially other "global" dlls on the system. Get dependency walker https://en.wikipedia.org/wiki/Dependency_Walker and then run it on ur sys and on his and see whats missing.

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 17:48
by Anasky
We just ran it on both of our pc's, and came to quite a long list of differences.
After which we realized he's running Windows 10 and I'm running Windows 7.

We tried to do the dll-creation the other way around: him creating the dll's, and me using his.
Once we did that, it worked for him, and it stopped working for me...

In all honesty, I've got no clue what's going on here...

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 18:35
by Ident
Anasky wrote:We just ran it on both of our pc's, and came to quite a long list of differences.
After which we realized he's running Windows 10 and I'm running Windows 7.

That's quite a difference of OS versions ;)

Anasky wrote:We tried to do the dll-creation the other way around: him creating the dll's, and me using his.
Once we did that, it worked for him, and it stopped working for me...

In all honesty, I've got no clue what's going on here...

Well how do you compile and how does he compile? Have you both installed the redistributables of the msvc version you use?

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 19:03
by Anasky
Indeed it is :?

We both use Visual Studio. We both have the exact same settings, configuration, and version of Visual Studio 2017, with the exception of Dark / Light theme. So as for redistributable version, I assume they're identical due to identical visual studio versions.
I will try and run it on my other laptop tomorrow, see what results I get from that one and if it will work there (that one uses Windows 7 as well).

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 19:05
by Ident
Ok interesting, need more info though.

Any difference between debug/release?

Full callstack on the error please.

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 19:16
by Anasky
I have attached a screenshot of the error.
Both debug and release give an error, regardless of whether it's Win32 or x64. If he compiles the dll files for Win32 himself, that one will work, but the others won't. (aka: only locally created dll files work)

Re: Error at runtime when running on another pc

Posted: Tue Sep 26, 2017 19:42
by Ident
Is the pdb file present? looks like there is no symbols. We need the pdb files for the CEGUI dlls to get a proper stack.

Re: Error at runtime when running on another pc

Posted: Wed Sep 27, 2017 06:41
by Anasky
The app also crashes on my other laptop, with Windows 7. Ran the dependency walker, and it gave the same result as on my computer (see attachment).

Including the wkernelbase.pdb symbols didn't help much... Attached that screenshot as well :/

EDIT: Apparently I forgot to commit the .pdb file for CEGUIBase-0_d.dll; I'll get back to you once I have the file.

EDIT2: Another screenshot attached. It seems to be going wrong in the XMLParser code, although we can't look at it.

EDIT3: We found it! Apparently CEGUI doesn't crash when it's missing the ExpatParser_d.dll when running locally, but requires it when running on another pc. Adding CEGUICoreWindowRendererSet_d, CEGUIExpatParser_d, and CEGUISILLYImageCodec_d to the Win32/Debug/ folder solved the issue. Thanks a lot Ident :D

The code seems to be crashing on the last line of this function:

Code: Select all

void System::setupXMLParser()
{
    // handle creation / initialisation of XMLParser
    if (!d_xmlParser)
    {
#ifndef CEGUI_STATIC
        setXMLParser(d_defaultXMLParserName);
#else
        //Static Linking Call
        d_xmlParser = createParser();
        // make sure we know to cleanup afterwards.
        d_ourXmlParser = true;
      d_xmlParser->initialise();
#endif
    }
    // parser object already set, just initialise it.
    else
        d_xmlParser->initialise();
}


Code: Select all

DynamicModule::DynamicModule(const String& name) :
    d_pimpl(CEGUI_NEW_AO Impl(name))
{
   if (name.empty())
      return;

    if (!hasDynamicLibraryExtension(d_pimpl->d_moduleName))
        addLibraryNameSuffixes(d_pimpl->d_moduleName);

    d_pimpl->d_handle = DynLibLoad(d_pimpl->d_moduleName);

#if defined(__linux__) || defined(__APPLE__) || defined(__MINGW32__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
    // see if adding a leading 'lib' helps us to open the library
    if (!d_pimpl->d_handle && d_pimpl->d_moduleName.compare(0, 3, "lib") != 0)
    {
        d_pimpl->d_moduleName.insert(0, "lib");
        d_pimpl->d_handle = DynLibLoad(d_pimpl->d_moduleName);
    }
#endif

#if defined(__CYGWIN__)
    // see if adding a leading 'cyg' helps us to open the library
    if (!d_pimpl->d_handle && d_pimpl->d_moduleName.compare(0, 3, "cyg") != 0)
    {
        d_pimpl->d_moduleName.insert(0, "cyg");
        d_pimpl->d_handle = DynLibLoad(d_pimpl->d_moduleName);
    }
#endif

    // check for library load failure
    if (!d_pimpl->d_handle)
        CEGUI_THROW(GenericException("Failed to load module '" +
            d_pimpl->d_moduleName + "': " + getFailureString()));
}

Re: Error at runtime when running on another pc

Posted: Thu Oct 05, 2017 16:22
by Ident
Anasky wrote:EDIT3: We found it! Apparently CEGUI doesn't crash when it's missing the ExpatParser_d.dll when running locally, but requires it when running on another pc. Adding CEGUICoreWindowRendererSet_d, CEGUIExpatParser_d, and CEGUISILLYImageCodec_d to the Win32/Debug/ folder solved the issue. Thanks a lot Ident :D

Uh, what?!?
It needs one parser at least, so if there was none present, it should never have run. But again, thats something that depends exe can be used to find out. It will tell you what dlls are used and also from where.

If I were you I would investigate this further to fully understand what is going on because what you described (although I might be getting somethign there wrong or missing a piece in the picture) aint sounding kosher.

Re: Error at runtime when running on another pc

Posted: Wed Oct 11, 2017 09:47
by Anasky
Ident wrote:
Anasky wrote:EDIT3: We found it! Apparently CEGUI doesn't crash when it's missing the ExpatParser_d.dll when running locally, but requires it when running on another pc. Adding CEGUICoreWindowRendererSet_d, CEGUIExpatParser_d, and CEGUISILLYImageCodec_d to the Win32/Debug/ folder solved the issue. Thanks a lot Ident :D

Uh, what?!?
It needs one parser at least, so if there was none present, it should never have run. But again, thats something that depends exe can be used to find out. It will tell you what dlls are used and also from where.

If I were you I would investigate this further to fully understand what is going on because what you described (although I might be getting somethign there wrong or missing a piece in the picture) aint sounding kosher.


My guess is that by creating the DLLs locally, it will remember a fixed path as to where it was initially created. At the point where it couldn't find the parser at the .exe file location, it'd look at the fixed path and find it over there.