SOLVED - Strange segfault in Root::initialise()

Problems building or running the engine, queries about how to use features etc.
Post Reply
_root
Gnoblar
Posts: 5
Joined: Wed May 03, 2006 12:08 pm
Location: Novosibirsk, Russia
Contact:

SOLVED - Strange segfault in Root::initialise()

Post by _root »

Hello.

I've just installed Ogre 1.4.5 on Gentoo Linux, and I'm having strange problems when I'm trying to use it.

First of all, the demo programs all work well.

I'm initialising OGRE using this code:

Code: Select all

    Root* root = new Root((sConfigDir + "/ogre_plugins.conf").c_str());
    ResourceGroupManager::getSingleton().addResourceLocation("./ogre/OgreCore.zip", "Zip", "Bootstrap");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/fonts", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/materials/programs", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/materials/scripts", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/materials/textures", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/models", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/overlays", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/particle", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/gui", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/DeferredShadingMedia", "FileSystem");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/packs/cubemap.zip", "Zip");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/packs/cubemapsJS.zip", "Zip");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/packs/dragon.zip", "Zip");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/packs/fresneldemo.zip", "Zip");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/packs/ogretestmap.zip", "Zip");
    ResourceGroupManager::getSingleton().addResourceLocation("/home/droot/deeptown/libs/ogrenew/Samples/Media/packs/skybox.zip", "Zip");
    if(!root->restoreConfig() && !root->showConfigDialog()) {
        // TODO: log message
        delete root;
        return;
    }
    m_pRenderWindow = root->initialise(true);
(I need more complex initialization in my code, with creating and registering a custom archive factories, but I've specially made the initialization code as close to the samples as possible).

I've checked all paths, of course.

When I'm trying to run this code, the render window appears, then immediately disappears and I've got the following in the stdout:

Code: Select all

******************************
*** Starting GLX Subsystem ***
******************************
GLRenderSystem::createRenderWindow "OGRE Render Window", 800x600 windowed  miscParams: FSAA=0 title=OGRE Render Window
GLXWindow::create
Parsing miscParams
GLXWindow::create -- Best visual is 35
XIO:  fatal IO error 14 (Bad address) on X server ":0.0"
      after 30 requests (30 known processed) with 5 events remaining.
Segmentation fault
(this is only the end of a log; all that is upper is identical to logs generated by sample applications).

plugins.cfg and ogre.cfg files are equal to those used with sample programs.

Here is the valgrind output:

Code: Select all

==13702== Process terminating with default action of signal 11 (SIGSEGV)
==13702==  Access not within mapped region at address 0x228
==13702==    at 0x11982DB3: _nv000127gl (in /usr/lib64/opengl/nvidia/lib/libGLcore.so.100.14.19)
==13702==    by 0x11330EF9: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x11314BDE: _fini (in /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x400D302: (within /lib64/ld-2.6.1.so)
==13702==    by 0x60889E8: exit (in /lib64/libc-2.6.1.so)
==13702==    by 0xE4A1EA9: _XDefaultIOError (in /usr/lib64/libX11.so.6.2.0)
==13702==    by 0xE4A1F23: _XIOError (in /usr/lib64/libX11.so.6.2.0)
==13702==    by 0xE4A2D55: _XRead (in /usr/lib64/libX11.so.6.2.0)
==13702==    by 0x11338DDD: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x1131258A: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x11333285: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x1133317C: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x11332CF1: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x1130AFF9: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x11311129: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x1130E720: (within /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x11308DE7: glXCreateContext (in /usr/lib64/opengl/nvidia/lib/libGL.so.100.14.19)
==13702==    by 0x10D71CA9: Ogre::GLXWindow::create(std::string const&, unsigned, unsigned, bool, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*) (OgreGLXWindow.cpp:373)
==13702==    by 0x10D6AC6B: Ogre::GLXGLSupport::newWindow(std::string const&, unsigned, unsigned, bool, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*) (OgreGLXGLSupport.cpp:146)
==13702==    by 0x10D3AB39: Ogre::GLRenderSystem::createRenderWindow(std::string const&, unsigned, unsigned, bool, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const*) (OgreGLRenderSystem.cpp:735)
==13702==    by 0x10D6B630: Ogre::GLXGLSupport::createWindow(bool, Ogre::GLRenderSystem*, std::string const&) (OgreGLXGLSupport.cpp:135)
==13702==    by 0x10D31AEE: Ogre::GLRenderSystem::initialise(bool, std::string const&) (OgreGLRenderSystem.cpp:195)
==13702==    by 0xC45AC9C: Ogre::Root::initialise(bool, std::string const&) (OgreRoot.cpp:498)
==13702==    by 0xBF3F03B: WS::CClientWorldManager::DoWork() (CClientWorldManager.cpp:119)
==13702==    by 0xBF5FA0D: WS::CWorldManager::Work() (CWorldManager.cpp:33)
==13702==    by 0xBF5F58F: WS::CWorldManager::WorkTP(void*) (CWorldManager.cpp:40)
==13702==    by 0x56B0182: Deep::CUserDB::ChildTP_Start(void*) (CUserDB.cpp:188)
==13702==    by 0x5B4516B: Thread::osa_create_thread(void*) (thread.cpp:46)
==13702==    by 0x4E2C046: (within /lib64/libpthread-2.6.1.so)
==13702==    by 0x611625C: clone (in /lib64/libc-2.6.1.so)
Valgrind doesn't report anything at this point when I run the sample programs.

I use linux 2.6.22 kernel on x86_64 arch (AMD Athlon), NVidia GeForce 8500 GT video card.

What am I doing wrong?
Last edited by _root on Sun Nov 25, 2007 6:56 pm, edited 1 time in total.
User avatar
Aquatix
Goblin
Posts: 239
Joined: Sun Oct 14, 2007 8:10 pm
Contact:

Post by Aquatix »

I might be wrong here, but from what I remember, Ogre would not run on a x64 Linux.
The mistery of Yoda's speech uncovered is:
Just an old Forth programmer Yoda was. :)

Nulle rule sine exceptione (lat.)
_root
Gnoblar
Posts: 5
Joined: Wed May 03, 2006 12:08 pm
Location: Novosibirsk, Russia
Contact:

Post by _root »

Aquatix wrote:I might be wrong here, but from what I remember, Ogre would not run on a x64 Linux.
I don't think so. I searched the site and couldn't find this information. Also, there are binary builds of OGRE for x86_64 systems exists.

And once again: the sample programs work well for me, that's why this error looks very strange. Probably I missed some initialization steps, but I looked at source code of samples a couple of times and I couldn't find principal difference.
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

That's some strange error... Let's go with the questions: Is the Ogre.cfg a correct one you were using with the samples? Have you tried adding the resource locations after Root::initialise()?
Image
_root
Gnoblar
Posts: 5
Joined: Wed May 03, 2006 12:08 pm
Location: Novosibirsk, Russia
Contact:

Post by _root »

Is the Ogre.cfg a correct one you were using with the samples?
Yes, Ogre.cfg is absolutely the same.

Also, I tried to remove ogre.cfg - in this case, the configuration screen appears, I choose the same config options, press OK, and see the same effect - render window appears and immediately disappears with the same error message.
Have you tried adding the resource locations after Root::initialise()?
Yes, I have. No effect.
_root
Gnoblar
Posts: 5
Joined: Wed May 03, 2006 12:08 pm
Location: Novosibirsk, Russia
Contact:

Post by _root »

Oh, I'm very sorry. That was my error.
OGRE is run in separate thread in my program. I've created a thread with too low stack size.
Post Reply