SIGSEGV with ExampleApplication

Problems building or running the engine, queries about how to use features etc.
Post Reply
Taratata
Gnoblar
Posts: 1
Joined: Sun Jan 15, 2017 1:32 pm

SIGSEGV with ExampleApplication

Post by Taratata »

Hello,

After spending more than 3 days trying to compile Ogre3D 1.9 with MinGW, I finally succeeded but I still have a problem.
I have a SIGSEGV using the ExampleApplication class that crashs my application.
My IDE wrote:The inferior stopped because it received a signal from the operating system.
Signal name : SIGSEGV
Signal meaning : Segmentation fault
My code :

Ogre.pro

Code: Select all

TEMPLATE = app
CONFIG -= app_bundle

#Boost (There's probably useless libs)
LIBS += -LC:/devMinGW/boost_1_63_0/build/boost/bin.v2/libs/system/build/gcc-mingw-5.3.0/release/threading-multi -lboost_system-mgw53-mt-1_63
LIBS += -LC:/devMinGW/boost_1_63_0/build/boost/bin.v2/libs/system/build/gcc-mingw-5.3.0/release -lboost_system-mgw53-1_63
LIBS += -LC:/devMinGW/boost_1_63_0/build/boost/bin.v2/libs/iostreams/build/gcc-mingw-5.3.0/release -lboost_iostreams-mgw53-1_63
LIBS += -LC:/devMinGW/boost_1_63_0/build/boost/bin.v2/libs/chrono/build/gcc-mingw-5.3.0/release -lboost_chrono-mgw53-1_63

LIBS += -LC:/devMinGW/ogredeps/build/rel/ogredeps/lib/Release -lOIS

#Ogre
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgreMain
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgreOverlay
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgrePaging
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgreProperty
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgreRTShaderSystem
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgreTerrain
LIBS += -LC:/devMinGW/ogre/build/rel/lib -lOgreVolume

INCLUDEPATH += C:/devMinGW/ogre/build/rel/sdk/include
INCLUDEPATH += C:/devMinGW/ogre/build/rel/sdk/include/OGRE
INCLUDEPATH += C:/devMinGW/ogre/build/rel/sdk/include/OIS
INCLUDEPATH += C:/devMinGW/boost_1_63_0/boost/convert/detail
INCLUDEPATH += C:/devMinGW/boost_1_63_0/boost/convert
INCLUDEPATH += C:/devMinGW/boost_1_63_0
INCLUDEPATH += C:/devMinGW/ogre/build/rel/sdk/include/OGRE/Overlay

SOURCES += main.cpp

HEADERS += \
    premiereapplication.h
main.cpp

Code: Select all

#include <Ogre.h>
#include "premiereapplication.h"

#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
#else
int main(int argc, char **argv)
#endif
{
    PremiereApplication app;
    try {
        app.go();            //---------------SIGSEGV from here
    } catch(Ogre::Exception& e ){
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
        fprintf(stderr, "An exception has occurred: %s\n",
            e.getFullDescription().c_str());
#endif
    }

    return 0;
}
PremiereApplication.h :

Code: Select all

#ifndef PREMIEREAPPLICATION_H
#define PREMIEREAPPLICATION_H

#include "ExampleApplication.h"

class PremiereApplication : public ExampleApplication
{
public:
    void createScene()
    {
    }
};
#endif // PREMIEREAPPLICATION_H
And were the SIGSEGV is :

ExampleApplication.h

Code: Select all

...
    /// Start the example
    virtual void go(void)
    {
        if (!setup())  //---------------SIGSEGV from here
            return;

        mRoot->startRendering();

        // clean up
        destroyScene();	

#ifdef INCLUDE_RTSHADER_SYSTEM
		// Finalize shader generator.
		finalizeShaderGenerator();
#endif

    }
...
ExampleApplication.h

Code: Select all

...
     // These internal methods package up the stages in the startup process
    /** Sets up the application - returns false if the user chooses to abandon configuration. */
    virtual bool setup(void)
    {

		String pluginsPath;
		// only use plugins.cfg if not static
#ifndef OGRE_STATIC_LIB
#if OGRE_DEBUG_MODE
		pluginsPath = mResourcePath + "plugins_d.cfg";
#else
		pluginsPath = mResourcePath + "plugins.cfg";
#endif
#endif
		
        mRoot = OGRE_NEW Root(pluginsPath, 
            mConfigPath + "ogre.cfg", mResourcePath + "Ogre.log");  //---------------SIGSEGV from here
		mOverlaySystem = OGRE_NEW OverlaySystem();
#ifdef OGRE_STATIC_LIB
		mStaticPluginLoader.load();
#endif
        setupResources();
...
OgreRoot.cpp

Code: Select all

...
Root::Root(const String& pluginFileName, const String& configFileName,
		const String& logFileName)
      : mQueuedEnd(false)
      , mLogManager(0)
	  , mRenderSystemCapabilitiesManager(0)
	  , mNextFrame(0)
	  , mFrameSmoothingTime(0.0f)
	  , mRemoveQueueStructuresOnClear(false)
	  , mDefaultMinPixelSize(0)
	  , mNextMovableObjectTypeFlag(1)
	  , mIsInitialised(false)
	  , mIsBlendIndicesGpuRedundant(true)
	  , mIsBlendWeightsGpuRedundant(true)
    {
        // superclass will do singleton checking
        String msg;

        // Init
        mActiveRenderer = 0;
        mVersion = StringConverter::toString(OGRE_VERSION_MAJOR) + "." +
            StringConverter::toString(OGRE_VERSION_MINOR) + "." +
            StringConverter::toString(OGRE_VERSION_PATCH) +
			OGRE_VERSION_SUFFIX + " " +
            "(" + OGRE_VERSION_NAME + ")";
		mConfigFileName = configFileName;

		// Create log manager and default log file if there is no log manager yet
		if(LogManager::getSingletonPtr() == 0)
		{
			mLogManager = OGRE_NEW LogManager();
                        mLogManager->createLog(logFileName, true, true); //---------------SIGSEGV from here
		}

#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
        mAndroidLogger = OGRE_NEW AndroidLogListener();
        mLogManager->getDefaultLog()->addListener(mAndroidLogger);
#endif
...
OgreLogManager.cpp

Code: Select all

...
Log* LogManager::createLog( const String& name, bool defaultLog, bool debuggerOutput, 
		bool suppressFileOutput)
    {
        OGRE_LOCK_AUTO_MUTEX;

        Log* newLog = OGRE_NEW Log(name, debuggerOutput, suppressFileOutput);  //---------------SIGSEGV from here

        if( !mDefaultLog || defaultLog )
        {
            mDefaultLog = newLog;
        }

        mLogs.insert( LogList::value_type( name, newLog ) );

        return newLog;
    }
...
OgreLog.cpp

Code: Select all

...
Log::Log( const String& name, bool debuggerOuput, bool suppressFile ) :
    mLogLevel(LL_NORMAL), mDebugOut(debuggerOuput),
    mSuppressFile(suppressFile), mTimeStamp(true), mLogName(name) //---------------SIGSEGV from here
{
    if (!mSuppressFile)
    {
        mLog.open(name.c_str());
    }
}
...
fstream

Code: Select all

...
// Constructors:
      /**
       *  @brief  Default constructor.
       *
       *  Initializes @c sb using its default constructor, and passes
       *  @c &sb to the base class initializer.  Does not open any files
       *  (you haven't given it a filename to open).
       */
      basic_ofstream(): __ostream_type(), _M_filebuf()
        { this->init(&_M_filebuf); }  //---------------SIGSEGV here
...
Locals and Expressions in fstream : wrote: Name Value Type
__vtt_parm <optimized out> void**
this @0x29820a0 std::basic_ofstream<char,std::char_traits<char>>

I'm using MinGW 5.3.0 32 bits on Windows 10 in QtCreator.

If anyone finds a solution or has a version of Ogre3d compiled compatible with MinGW 5.3.0 I am a taker.

Thank you in advance.
Post Reply