[solved] mRoot->initialise(false) segfault in Ubuntu 64bi

Problems building or running the engine, queries about how to use features etc.
Post Reply
schnorr
Gnoblar
Posts: 21
Joined: Wed Jun 06, 2007 4:06 pm
Location: France

[solved] mRoot->initialise(false) segfault in Ubuntu 64bi

Post by schnorr »

Hello,

I am getting a problem when initializing Ogre in an Ubuntu 64 bits installation.
I am using Ogre inside a wxWidgets window. This works fine in another PC with the ubuntu at a 32 bits architecture.

Here is the initialization code of my app:

Code: Select all

        Ogre::RenderSystem *r;
        r = mRoot->getRenderSystemByName ("OpenGL Rendering Subsystem");
        if (!r){
                std::cout << "Ogre Rendering System not found" << std::endl;
                return false;
        }
        mRoot->setRenderSystem (r);
        mRoot->initialise(false);
Follows Ogre.log (only the part that I think is involved with the problem):

Code: Select all

(...)
10:32:10: Added resource location './Media/packs/dragon.zip' of type 'Zip' to resource group 'General'
10:32:10: Added resource location './Media/packs/fresneldemo.zip' of type 'Zip' to resource group 'General'
10:32:10: Added resource location './Media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
10:32:10: Added resource location './Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
10:32:10: CPU Identifier & Features
10:32:10: -------------------------
10:32:10:  *   CPU ID: Unknown
10:32:10: -------------------------
10:32:10: ******************************
*** Starting GLX Subsystem ***
******************************
The segmentation fault appears after the last line of the "Starting GLX Subsystem".

This is the backtrace that gdb gives me:

Code: Select all

(...)
Added resource location './Media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
Added resource location './Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
CPU Identifier & Features
-------------------------
 *   CPU ID: Unknown
-------------------------
******************************
*** Starting GLX Subsystem ***
******************************

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47765270425888 (LWP 9647)]
0x0000000000000000 in ?? ()
(gdb) where
#0  0x0000000000000000 in ?? ()
#1  0x00002b7139c7c496 in ?? () from /usr/lib/OGRE/RenderSystem_GL.so
#2  0x00002b7139c7b3a4 in ?? () from /usr/lib/OGRE/RenderSystem_GL.so
#3  0x00002b712ca70f5d in Ogre::Root::initialise ()
   from /usr/lib/libOgreMain.so.14
Segmentation fault (core dumped)
The thing more strange in all this is that when I call mRoot->initialise(true), it works, but I get another window automatically created by Ogre (as expected). So, does anyone know what is causing the segfault when executing mRoot->initialise(false)?

This is my plugins.cfg:

Code: Select all

# Defines plugins to load

# Define plugin folder
PluginFolder=/usr/lib/OGRE

# Define D3D rendering implementation plugin
Plugin=RenderSystem_GL.so
Plugin=Plugin_ParticleFX.so
Plugin=Plugin_BSPSceneManager.so
Plugin=Plugin_OctreeSceneManager.so
#Plugin=Plugin_CgProgramManager.so
and ogre.cfg (I don't think that this config is being used):

Code: Select all

Render System=OpenGL Rendering Subsystem

[OpenGL Rendering Subsystem]
FSAA=0
Full Screen=Yes
RTT Preferred Mode=FBO
Video Mode=800 x 600
Thanks in advance...
Last edited by schnorr on Fri Mar 28, 2008 12:45 am, edited 1 time in total.
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Re: mRoot->initialise(false) gives segfault in Ubuntu 64b

Post by DWORD »

schnorr wrote:This is the backtrace that gdb gives me:

Code: Select all

(...)
Added resource location './Media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
Added resource location './Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
CPU Identifier & Features
-------------------------
 *   CPU ID: Unknown
-------------------------
******************************
*** Starting GLX Subsystem ***
******************************

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47765270425888 (LWP 9647)]
0x0000000000000000 in ?? ()
(gdb) where
#0  0x0000000000000000 in ?? ()
#1  0x00002b7139c7c496 in ?? () from /usr/lib/OGRE/RenderSystem_GL.so
#2  0x00002b7139c7b3a4 in ?? () from /usr/lib/OGRE/RenderSystem_GL.so
#3  0x00002b712ca70f5d in Ogre::Root::initialise ()
   from /usr/lib/libOgreMain.so.14
Segmentation fault (core dumped)
Try compiling Ogre with '-g -O0' to get a better backtrace and be able to debug the problem.
schnorr
Gnoblar
Posts: 21
Joined: Wed Jun 06, 2007 4:06 pm
Location: France

Post by schnorr »

Hi,
follows a more detailed stack trace of the seg fault cause by
calling root->initialise(false) in a Ubuntu Linux running over a 64 bits architecture. The same code works in a 32 bits computer.
*-*-* OGRE Initialising
*-*-* Version 1.4.3 (Eihort)
(...)
Added resource location './Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
CPU Identifier & Features
-------------------------
* CPU ID: Unknown
-------------------------
******************************
*** Starting GLX Subsystem ***
******************************

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47591777358112 (LWP 8943)]
0x0000000000000000 in ?? ()
(gdb) where
#0 0x0000000000000000 in ?? ()
#1 0x00002b48d4c9a496 in Ogre::GLRenderSystem::_setCullingMode (
this=<value optimized out>, mode=3539718640) at OgreGLRenderSystem.cpp:1504
#2 0x00002b48d4c993a4 in Ogre::GLRenderSystem::initialise (this=0x8cac00,
autoCreateWindow=false, windowTitle=<value optimized out>)
at OgreGLRenderSystem.cpp:198
#3 0x00002b48c7a8ef5d in Ogre::Root::initialise (this=0x8b8b30,
autoCreateWindow=false, windowTitle=@0x7fffe3b63a10) at OgreRoot.cpp:498
Segmentation fault (core dumped)
Does anyone have any idea about how to solve this problem?

Thanks
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

Clearly something goes terribly wrong inside GLRenderSystem::_setCullingMode(), but it's hard to guess what it could be. Not many functions are called there, but it looks like one of the function pointers is zero.

Can you maybe figure out which of them/which line of code? If gdb is not your cup of tea, I can recommend 'ddd' which is a nice visual debugger running on top of gdb.

Are you sure your OGL drivers are setup correctly and working? Which graphics hardware are you using? Can you post the full Ogre.log?
schnorr
Gnoblar
Posts: 21
Joined: Wed Jun 06, 2007 4:06 pm
Location: France

Post by schnorr »

Hi,
I just download ogre 1.4.7 sources. The error continues. More info.

Ogre.log
23:43:27: Creating resource group General
23:43:27: Creating resource group Internal
23:43:27: Creating resource group Autodetect
23:43:27: SceneManagerFactory for type 'DefaultSceneManager' registered.
23:43:27: Registering ResourceManager for type Material
23:43:27: Registering ResourceManager for type Mesh
23:43:27: Registering ResourceManager for type Skeleton
23:43:27: MovableObjectFactory for type 'ParticleSystem' registered.
23:43:27: OverlayElementFactory for type Panel registered.
23:43:27: OverlayElementFactory for type BorderPanel registered.
23:43:27: OverlayElementFactory for type TextArea registered.
23:43:27: Registering ResourceManager for type Font
23:43:27: ArchiveFactory for archive type FileSystem registered.
23:43:27: ArchiveFactory for archive type Zip registered.
23:43:27: FreeImage version: 3.9.3
23:43:27: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
23:43:27: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi
23:43:27: DDS codec registering
23:43:27: Registering ResourceManager for type HighLevelGpuProgram
23:43:27: Registering ResourceManager for type Compositor
23:43:27: MovableObjectFactory for type 'Entity' registered.
23:43:27: MovableObjectFactory for type 'Light' registered.
23:43:27: MovableObjectFactory for type 'BillboardSet' registered.
23:43:27: MovableObjectFactory for type 'ManualObject' registered.
23:43:27: MovableObjectFactory for type 'BillboardChain' registered.
23:43:27: MovableObjectFactory for type 'RibbonTrail' registered.
23:43:27: Loading library /usr/lib/OGRE/RenderSystem_GL.so
23:43:28: Installing plugin: GL RenderSystem
23:43:28: OpenGL Rendering Subsystem created.
23:43:28: Plugin successfully installed
23:43:28: Loading library /usr/lib/OGRE/Plugin_ParticleFX.so
23:43:28: Installing plugin: ParticleFX
23:43:28: Particle Emitter Type 'Point' registered
23:43:28: Particle Emitter Type 'Box' registered
23:43:28: Particle Emitter Type 'Ellipsoid' registered
23:43:28: Particle Emitter Type 'Cylinder' registered
23:43:28: Particle Emitter Type 'Ring' registered
23:43:28: Particle Emitter Type 'HollowEllipsoid' registered
23:43:28: Particle Affector Type 'LinearForce' registered
23:43:28: Particle Affector Type 'ColourFader' registered
23:43:28: Particle Affector Type 'ColourFader2' registered
23:43:28: Particle Affector Type 'ColourImage' registered
23:43:28: Particle Affector Type 'ColourInterpolator' registered
23:43:28: Particle Affector Type 'Scaler' registered
23:43:28: Particle Affector Type 'Rotator' registered
23:43:28: Particle Affector Type 'DirectionRandomiser' registered
23:43:28: Particle Affector Type 'DeflectorPlane' registered
23:43:28: Plugin successfully installed
23:43:28: Loading library /usr/lib/OGRE/Plugin_BSPSceneManager.so
23:43:29: Installing plugin: BSP Scene Manager
23:43:29: Plugin successfully installed
23:43:29: Loading library /usr/lib/OGRE/Plugin_OctreeSceneManager.so
23:43:29: Installing plugin: Octree & Terrain Scene Manager
23:43:29: Plugin successfully installed
23:43:29: *-*-* OGRE Initialising
23:43:29: *-*-* Version 1.4.7 (Eihort)
23:43:29: Creating resource group Bootstrap
23:43:29: Added resource location './Media/packs/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
23:43:29: Added resource location './Media/VisuApp/materials/scripts' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/VisuApp/kaapi/' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/fonts' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/configs' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/fonts' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/imagesets' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/layouts' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/looknfeel' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/lua_scripts' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/gui2/schemes' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/materials/programs' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/materials/scripts' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/materials/textures' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/models' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/overlays' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/particle' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/DeferredShadingMedia' of type 'FileSystem' to resource group 'General'
23:43:29: Added resource location './Media/packs/cubemap.zip' of type 'Zip' to resource group 'General'
23:43:29: Added resource location './Media/packs/cubemapsJS.zip' of type 'Zip' to resource group 'General'
23:43:29: Added resource location './Media/packs/dragon.zip' of type 'Zip' to resource group 'General'
23:43:29: Added resource location './Media/packs/fresneldemo.zip' of type 'Zip' to resource group 'General'
23:43:29: Added resource location './Media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
23:43:29: Added resource location './Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
23:43:29: CPU Identifier & Features
23:43:29: -------------------------
23:43:29: * CPU ID: Unknown
23:43:29: -------------------------
23:43:29: ******************************
*** Starting GLX Subsystem ***
******************************
GDB log (had to specify ogre sources by hand)
******************************
*** Starting GLX Subsystem ***
******************************

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47009497948528 (LWP 11853)]
0x0000000000000000 in ?? ()
(gdb) directory /home/schnorr/misc/ogre-1.4.7/
Source directories searched: /home/schnorr/misc/ogre-1.4.7:$cdir:$cwd
(gdb) up
#1 0x00002ac1423af496 in Ogre::GLRenderSystem::_setCullingMode (
this=<value optimized out>, mode=1080894016) at OgreGLRenderSystem.cpp:1504
1504 OgreGLRenderSystem.cpp: No such file or directory.
in OgreGLRenderSystem.cpp
Current language: auto; currently c++
(gdb) directory /home/schnorr/misc/ogre-1.4.7/RenderSystems/GL/src/
Source directories searched: /home/schnorr/misc/ogre-1.4.7/RenderSystems/GL/src:/home/schnorr/misc/ogre-1.4.7:$cdir:$cwd
(gdb) down
#0 0x0000000000000000 in ?? ()
(gdb) up
#1 0x00002ac1423af496 in Ogre::GLRenderSystem::_setCullingMode (
this=<value optimized out>, mode=1080894016) at OgreGLRenderSystem.cpp:1504
warning: Source file is more recent than executable.
1504 }
(gdb) l
1499 break;
1500 }
1501
1502 glEnable( GL_CULL_FACE );
1503 glCullFace( cullMode );
1504 }
1505 //-----------------------------------------------------------------------------
1506 void GLRenderSystem::_setDepthBufferParams(bool depthTest, bool depthWrite, CompareFunction depthFunction)
1507 {
1508 _setDepthBufferCheckEnabled(depthTest);
(gdb) p mode
$1 = 1080894016
(gdb) p cullMode
$2 = 1029
(gdb) up
#2 0x00002ac1423ae3a4 in Ogre::GLRenderSystem::initialise (this=0x8d2150,
autoCreateWindow=false, windowTitle=<value optimized out>)
at OgreGLRenderSystem.cpp:198
198 return autoWindow;
(gdb) l
193 mGLSupport->start();
194
195 RenderWindow* autoWindow = mGLSupport->createWindow(autoCreateWindow, this, windowTitle);
196
197
198 return autoWindow;
199 }
200
201 void GLRenderSystem::initGL(RenderTarget *primary)
202 {
(gdb) p autoWindow
$3 = (class Ogre::RenderWindow *) 0x0
(gdb)
glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
GLX_OML_swap_method, GLX_SGI_make_current_read, GLX_SGI_swap_control,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_visual_select_group
client glx vendor string: SGI
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_allocate_memory,
GLX_MESA_copy_sub_buffer, GLX_MESA_swap_control,
GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_OML_sync_control,
GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
GLX version: 1.2
GLX extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
GLX_MESA_swap_control, GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync,
GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_visual_select_group
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) 965GM 4.1.3002
OpenGL version string: 1.4 Mesa 7.0.1
OpenGL extensions:
GL_ARB_depth_texture, GL_ARB_fragment_program, GL_ARB_imaging,
GL_ARB_multisample, GL_ARB_multitexture, GL_ARB_point_parameters,
GL_ARB_shadow, GL_ARB_texture_border_clamp, GL_ARB_texture_compression,
GL_ARB_texture_cube_map, GL_ARB_texture_env_add,
GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar,
GL_ARB_texture_env_dot3, GL_ARB_texture_mirrored_repeat,
GL_ARB_texture_non_power_of_two, GL_ARB_texture_rectangle,
GL_ARB_transpose_matrix, GL_ARB_vertex_buffer_object,
GL_ARB_vertex_program, GL_ARB_window_pos, GL_EXT_abgr, GL_EXT_bgra,
GL_EXT_blend_color, GL_EXT_blend_equation_separate,
GL_EXT_blend_func_separate, GL_EXT_blend_logic_op, GL_EXT_blend_minmax,
GL_EXT_blend_subtract, GL_EXT_clip_volume_hint, GL_EXT_cull_vertex,
GL_EXT_compiled_vertex_array, GL_EXT_convolution, GL_EXT_copy_texture,
GL_EXT_draw_range_elements, GL_EXT_fog_coord, GL_EXT_histogram,
GL_EXT_multi_draw_arrays, GL_EXT_packed_pixels, GL_EXT_point_parameters,
GL_EXT_polygon_offset, GL_EXT_rescale_normal, GL_EXT_secondary_color,
GL_EXT_separate_specular_color, GL_EXT_shadow_funcs, GL_EXT_stencil_wrap,
GL_EXT_subtexture, GL_EXT_texture, GL_EXT_texture3D,
GL_EXT_texture_edge_clamp, GL_EXT_texture_env_add,
GL_EXT_texture_env_combine, GL_EXT_texture_env_dot3,
GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias,
GL_EXT_texture_object, GL_EXT_texture_rectangle, GL_EXT_vertex_array,
GL_3DFX_texture_compression_FXT1, GL_APPLE_client_storage,
GL_APPLE_packed_pixels, GL_ATI_blend_equation_separate,
GL_IBM_rasterpos_clip, GL_IBM_texture_mirrored_repeat,
GL_INGR_blend_func_separate, GL_MESA_pack_invert, GL_MESA_ycbcr_texture,
GL_MESA_window_pos, GL_NV_blend_square, GL_NV_light_max_exponent,
GL_NV_texture_rectangle, GL_NV_texgen_reflection, GL_OES_read_format,
GL_SGI_color_matrix, GL_SGI_color_table, GL_SGIS_generate_mipmap,
GL_SGIS_texture_border_clamp, GL_SGIS_texture_edge_clamp,
GL_SGIS_texture_lod, GL_SGIX_depth_texture, GL_SUN_multi_draw_arrays

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat
----------------------------------------------------------------------
0x23 24 tc 0 32 0 r y . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x24 24 tc 0 32 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x25 24 tc 0 32 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x26 24 tc 0 32 0 r . . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x27 24 tc 0 32 0 r y . 8 8 8 8 0 0 0 16 16 16 16 0 0 Slow
0x28 24 tc 0 32 0 r . . 8 8 8 8 0 0 0 16 16 16 16 0 0 Slow
0x29 24 tc 0 32 0 r y . 8 8 8 8 0 24 8 16 16 16 16 0 0 Slow
0x2a 24 tc 0 32 0 r . . 8 8 8 8 0 24 8 16 16 16 16 0 0 Slow
0x2b 24 dc 0 32 0 r y . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x2c 24 dc 0 32 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x2d 24 dc 0 32 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x2e 24 dc 0 32 0 r . . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x2f 24 dc 0 32 0 r y . 8 8 8 8 0 0 0 16 16 16 16 0 0 Slow
0x30 24 dc 0 32 0 r . . 8 8 8 8 0 0 0 16 16 16 16 0 0 Slow
0x31 24 dc 0 32 0 r y . 8 8 8 8 0 24 8 16 16 16 16 0 0 Slow
0x32 24 dc 0 32 0 r . . 8 8 8 8 0 24 8 16 16 16 16 0 0 Slow
0x66 32 tc 0 32 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 Ncon
I hope this info gives the answers. It's a little bit strange the value of "mode" variable, or am I wrong?

Well, I played with the breakpoints and it seems that the seg fault happens when the glCullFace( cullMode ); function is called (file OgreGLRenderSystem.cpp:1503). The value of cullMode (as above) is 1029. Another thing, there is a "default: " inside the switch, at line 1475. It that expected?
schnorr
Gnoblar
Posts: 21
Joined: Wed Jun 06, 2007 4:06 pm
Location: France

Post by schnorr »

compiling and linking the application with ogre 1.4.7 solved the problem.
Post Reply