Ogre App Full Wrap

knapper

31-08-2011 16:50:47

Howdy

I've been playing with Gorilla and been doing quite a bit of playing around with various other libraries. I'm minded to do something for-programmers-by-programmers to make using Ogre more productive.

I've gotten started with Boost Python and wrapped several types of objects to get back up to speed with C++.

Whenever I try renaming a working Ogre app's main function and wrapping it (as struct or function), I'm getting an invalid pointer from glibc. I'll get some error messages posted later today, but I'd like to discuss the general strategy a bit while I'm at it.

I have Cmake compiling a shared object that can be run as a python object. So far, so good. Whenever that functionality includes doing things like mRoot->render(); I start getting invalid pointer exceptions right after RenderSystemGL is loaded.

I've read some Boost docs that make me think I need to use some special pointer types to get ownership of the object in Python to keep bad things from happening.

I'm also suspecting that I might just be compiling the .so incorrectly and need to recompile Ogre in some way that allows it to be dynamically loaded into Python.

If anyone has been through the hoops enough times to at least tell me where I need to start reading, I'd greatly appreciate it :D

knapper

01-09-2011 00:44:02

Been trying to verify that my shared objects are linking correctly. For those on the steep part of the learning curve:
http://www.cyberciti.biz/tips/linux-sha ... ement.html

knapper

01-09-2011 01:06:49

Here's where it dies. Gdb produces very little data, but perhaps I'm still using it wrong. Haven't debugged a lot of python invalid pointer's :lol:

MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
*-*-* OGRE Initialising
*-*-* Version 1.7.3 (Cthugha)
Loading library RenderSystem_GL.so
Installing plugin: GL RenderSystem
OpenGL Rendering Subsystem created.
*** glibc detected *** python: free(): invalid pointer: 0x004517b0 ***

knapper

01-09-2011 01:38:15

Looks like here:
http://comments.gmane.org/gmane.comp.py ... B%2B/11769

This might also fix
http://www.boost.org/doc/libs/1_39_0/li ... orial.html

Very similar situation as my run function is just
App * app = new App();
app->mRoot->startRendering();

ie the function I'm calling creates a pointer and I'm not sure the python-ated object is getting "ownership". Definitely going to find a bit lower-level book on the subject so I'm not stuck navigating magic sandcastles.

The instantiation of App pointer alone will cause it to die. I guess I'll try writing code with similar pointer/object type relationship and wrap that first without including any Ogre functionality at first.

knapper

02-09-2011 15:26:11

Making some headway.

I can create the singleton in boost for Ogre::Root. I can call a method (isInitialised) no problem. When calling loadPlugin(), the return crashes.

I at least know that installPlugin is being called inside the shared object (RenderSystemGL.so) and I have read that a pointer referencing a pointer in a shared object that points to something defined in a shared object causes problems.

Right now I'm going to do more work on wrapping Singletons, investigate shared object compilation at little more, and probably download python Ogre again and pay more attention to what's going on there.

dermont

02-09-2011 16:08:10

I'm still not too sure what you are trying to do here. If you are trying to wrap an Ogre App you will probably be posting a simple example of your problem, something like the following; otherwise it will be difficult for anyone to help.


struct OgreEngine{
// ---------------------------------------------------------------------
OgreEngine()
{
this->mRoot = 0;
this->mWindow = 0;
}
// ---------------------------------------------------------------------
~OgreEngine()
{
if (this->mRoot)
delete this->mRoot;
}

// ---------------------------------------------------------------------
void initialise(std::string pluginname)
{
this->mRoot = new Ogre::Root(pluginname);
bool carryOn = this->mRoot->restoreConfig() || this->mRoot->showConfigDialog();
this->setupResources();
mWindow = this->mRoot->initialise(true);

}
// ---------------------------------------------------------------------
void setupResources(void)
{
// Load resource paths from config file
ConfigFile cf;
cf.load("resources.cfg");

// Go through all sections & settings in the file
ConfigFile::SectionIterator seci = cf.getSectionIterator();

String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
ConfigFile::SettingsMultiMap *settings = seci.getNext();
ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}
}

// ---------------------------------------------------------------------
void createScene()
{
Ogre::SceneManager* sceneMgr = this->mRoot->createSceneManager(Ogre::ST_GENERIC,"Test");
sceneMgr->setAmbientLight(Ogre::ColourValue(1.0, 1.0, 1.0));
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

Ogre::Camera* cam = sceneMgr->createCamera("TestCam");
cam->setPosition(Ogre::Vector3(0,0,500));
// Look back along -Z
cam->lookAt(Ogre::Vector3(0,0,-300));
cam->setNearClipDistance(5);

Ogre::Viewport* vp = this->mWindow->addViewport(cam);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));

SceneNode* headNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
Entity* ent = sceneMgr->createEntity("head", "ogrehead.mesh");
headNode->attachObject(ent);
}
// ---------------------------------------------------------------------
void loop()
{
while (!this->mWindow->isClosed())
{
Ogre::WindowEventUtilities::messagePump();
this->mRoot->renderOneFrame();
}
}
// ---------------------------------------------------------------------
void cleanup()
{
delete this->mRoot;
}

Ogre::Root* mRoot;
Ogre::RenderWindow* mWindow;

};



class_<OgreEngine>("Ogre")
.def("initialise", &OgreEngine::initialise)
.def("createScene", &OgreEngine::createScene)
.def("cleanup", &OgreEngine::cleanup)
.def("loop", &OgreEngine::loop)
;



c = yourmodule.Ogre()
c.initialise("plugins.cfg")
c.createScene()
c.loop()
c.cleanup()
del c

knapper

03-09-2011 01:25:13

The common theme:
Loading library /usr/local/lib/OGRE/RenderSystem_GL
Installing plugin: GL RenderSystem
OpenGL Rendering Subsystem created.
*** glibc detected *** python: free(): invalid pointer: 0x005ab7b0 ***

I put together your code, put together my code like your code, and this is what I keep getting. Other plugins load fine. Only RenderSystemGL has this problem. Without a render system, I haven't been able to test much else.

dermont

03-09-2011 04:54:51

I'm assuming that you have tried running your example without python and everything works OK.

1. Are you running 64 bit/32 bit? Check the usual scenarios, i.e. the GL RenderSystem you are loading is built against the same Ogre lib you are compiling your application against.

2. Try debugging your python demo with gdb (if your demo uses OIS you will need to set up OIS input Non-exclusive input):
>> sudo apt-get install python-dbg
>> gdb python
>> run yourdemo.py
>> bt

http://www.ogre3d.org/tikiwiki/Using+OIS

3. Zip up your C++/python example, I will try and run it here.

knapper

03-09-2011 05:19:03

Just saw your post. Pretty late here and I haven't been drinking any yerba this evening, so I'm going to crash. Feels much closer right now =) Yes, the application works in pure C++.

OpenGL Rendering Subsystem created.
*** glibc detected *** /usr/bin/python: free(): invalid pointer: 0x00f5a7b0 ***
^C
Program received signal SIGINT, Interrupt.
0x0012e416 in __kernel_vsyscall ()
(gdb) bt
#0 0x0012e416 in __kernel_vsyscall ()
#1 0x003fd753 in ?? () from /lib/i386-linux-gnu/libc.so.6
#2 0x00390b94 in ?? () from /lib/i386-linux-gnu/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


Blame the linker? Still not sure if I'm doing that right. The program doesn't actually crash out. I skimmed across an environment variable that should cause that glibc free pointer thing to go ahead and crash like it should (at least so I don't have to kill the process manually).

An investigation of the suspect shared object lead me to find:

user@host:/usr/local/lib/OGRE$ ldd RenderSystem_GL.so
linux-gate.so.1 => (0x00c53000)
libOgreMain.so.1.7.3 => not found
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00230000)


If I'm scratching the right place, please let me know. Better yet, I'm not exactly sure how to fix this seeing as how I just recently installed Ogre in a pretty vanilla way. I also found some orphan Ogre libs hanging around on my system. Considering a careful rebuild.

dermont

03-09-2011 06:17:14


An investigation of the suspect shared object lead me to find:

user@host:/usr/local/lib/OGRE$ ldd RenderSystem_GL.so
linux-gate.so.1 => (0x00c53000)
libOgreMain.so.1.7.3 => not found
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00230000)


If I'm scratching the right place, please let me know. Better yet, I'm not exactly sure how to fix this seeing as how I just recently installed Ogre in a pretty vanilla way. I also found some orphan Ogre libs hanging around on my system. Considering a careful rebuild.


No this isn't your problem libOgreMain.so.1.7.3 should be picked up since /usr/local/lib is in your path; unless you have another version of libOgreMain.so.1.7.3 in say /usr/local - but you would have encountered problems in C++.

You can check the paths from the libraries built by CMake, e.g:

ldd _yourmodule_.so

>> scanelf --rpath _yourmodule_.so
TYPE RPATH FILE
ET_DYN /media/sda8/Libraries/OGRE/sdk/default/lib:/usr/local/lib:/usr/lib/libpython2.7.so _ogreutilities_.so


You can also try a fudge to preload the Ogre lib thought I doubt this will help.

## preload libraries from non standard paths
##
import sys,os,ctypes
OGRE_PATH = '/media/sda8/Libraries/OGRE/sdk/default/lib'
sys.path.insert(0, OGRE_PATH)

preloadLibs = ['libOgreMain.so']
import ctypes
for lib in preloadLibs:
ctypes.CDLL(os.path.join(OGRE_PATH,lib), ctypes.RTLD_GLOBAL)
print ( "Preloading Lib %s" % os.path.join(OGRE_PATH,lib) )


I've attached my example with CMake file if it is any help, after building with CMake run example.py from lib dir.

knapper

03-09-2011 14:38:21

Had a few red herrings in there. Fixed some things so that all my C++ code is compiling and running off the installed libs. That's all clean. Compared some ldd and Rpaths to try to rule things out there. Code(s) runs in C++. In Python, loading RenderSystemGl plugin is crashing. Your code and mine.

The glibc behavior for invalid pointer can be specified with an environment variable. VERY helpful since the program neither crashes nor produces a full stack trace (requiring manual killing of the reluctantly departed) without this:
MALLOC_CHECK_=2
export MALLOC_CHECK_


Which leads me to some potentially useful debug information. Now on to learning how to read a backtrace =)

Wait for it..... BOOOM! I just learned how to read a backtrace. I have some C++ libraries installed for a second compiler I was using for GCCsense code-assist. This was because the gcc developers think that compiler based code completion and integration with flymake is for M$ users. Snobbish, and the custom compiler requirement strikes again. Another developer bites the dust and learns how to use gdb. I guess it's not so bad, but considering how awesome gccsense is, I really wish this I wasn't still feeling the pain of those other compiler libs sneaking into things.

I haven't used cmake much so far, so I'll have to figure out how it's sneaking those other libs back in. I haven't been having trouble with rogue linking for a while. **EDIT** On a bit further inspection....seriously...wrong libraries, cmake. WAAAY wrong headers there. There's a reason laundry soap doesn't go in the refrigerator... :lol:

Installing plugin: GL RenderSystem
OpenGL Rendering Subsystem created.

Program received signal SIGABRT, Aborted.
0x0012e416 in __kernel_vsyscall ()
(gdb) bt
#0 0x0012e416 in __kernel_vsyscall ()
#1 0x00349e71 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0x0034d34e in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x0038a993 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0x0038f486 in free () from /lib/i386-linux-gnu/libc.so.6
#5 0x0052c941 in operator delete (ptr=0x0)
at ../../.././libstdc++-v3/libsupc++/del_op.cc:44
#6 0x0051139d in _M_dispose (this=0xbfffe34c, __pos=0, __len1=0, __len2=11)
at /home/knappador/Desktop/tarballs/gcc-code-assist-0.1-4.4.4/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:231
#7 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate (this=0xbfffe34c, __pos=0, __len1=0, __len2=11)
at /home/knappador/Desktop/tarballs/gcc-code-assist-0.1-4.4.4/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:465
#8 0x005113ef in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_safe (this=0xbfffe34c, __pos1=0, __n1=0, __s=
0x15e328a "Full Screen", __n2=11)
at /home/knappador/Desktop/tarballs/gcc-code-assist-0.1-4.4.4/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:662
#9 0x01450f5e in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*, unsigned int) ()
from /usr/lib/i386-linux-gnu/libstdc++.so.6
#10 0x015b5f4d in assign (this=0x833fac8)
---Type <return> to continue, or q <return> to quit---
at /usr/include/c++/4.5/bits/basic_string.h:1078
#11 operator= (this=0x833fac8) at /usr/include/c++/4.5/bits/basic_string.h:541
#12 Ogre::GLXGLSupport::addConfig (this=0x833fac8)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/GLX/OgreGLXGLSupport.cpp:164
#13 0x01563b87 in Ogre::GLRenderSystem::initConfigOptions (this=0xb7c24c70)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLRenderSystem.cpp:171
#14 0x0156c813 in Ogre::GLRenderSystem::GLRenderSystem (this=0xb7c24c70)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLRenderSystem.cpp:121
#15 0x01561ca5 in Ogre::GLPlugin::install (this=0xb721c368)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLPlugin.cpp:49
#16 0x008cf102 in Ogre::Root::installPlugin (this=0xb7c1c260, plugin=
0xb721c368)
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:1287
#17 0x0154bb6c in Ogre::dllStartPlugin ()
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLEngineDll.cpp:41
#18 0x008cf520 in Ogre::Root::loadPlugin (this=0xb7c1c260, pluginName=...)
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:1332
#19 0x008cf930 in Ogre::Root::loadPlugins (this=0xb7c1c260, pluginsfile=...)
---Type <return> to continue, or q <return> to quit---
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:1052
#20 0x008d22d1 in Ogre::Root::Root (this=0xb7c1c260, pluginFileName=...,
configFileName=..., logFileName=...)
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:272
#21 0x004e02b7 in OgreEngine::initialise2(std::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#22 0x004e569e in _object* boost::python::detail::invoke<int, void (OgreEngine::*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::arg_from_python<OgreEngine&>, boost::python::arg_from_python<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(boost::python::detail::invoke_tag_<true, true>, int const&, void (OgreEngine::*&)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::arg_from_python<OgreEngine&>&, boost::python::arg_from_python<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#23 0x004e502c in boost::python::detail::caller_arity<2u>::impl<void (OgreEngine::*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::default_call_policies, boost::mpl::vector3<void, OgreEngine&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::operator()(_object*, _object*) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#24 0x004e4ace in boost::python::objects::caller_py_function_impl<boost::python:---Type <return> to continue, or q <return> to quit---
:detail::caller<void (OgreEngine::*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::default_call_policies, boost::mpl::vector3<void, OgreEngine&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::operator()(_object*, _object*) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#25 0x00b7b40f in boost::python::objects::function::call(_object*, _object*) const () from /usr/lib/libboost_python-py27.so.1.42.0
#26 0x00b7b5f7 in ?? () from /usr/lib/libboost_python-py27.so.1.42.0
#27 0x00b84342 in boost::python::handle_exception_impl(boost::function0<void>)
() from /usr/lib/libboost_python-py27.so.1.42.0
#28 0x00b7c967 in ?? () from /usr/lib/libboost_python-py27.so.1.42.0
#29 0x080a464a in PyObject_Call (func=
<Boost.Python.function at remote 0x8335530>, arg=
(<Test2 at remote 0xb7f3bc5c>, 'plugins.cfg'), kw=0x0)
at ../Objects/abstract.c:2529
#30 0x080dad43 in do_call (f=
Frame 0x8335b1c, for file example.py, line 34, in __init__ (self=<Test2 at remote 0xb7f3bc5c>), throwflag=0) at ../Python/ceval.c:4231
#31 call_function (f=
Frame 0x8335b1c, for file example.py, line 34, in __init__ (self=<Test2 at remote 0xb7f3bc5c>), throwflag=0) at ../Python/ceval.c:4036
#32 PyEval_EvalFrameEx (f=
Frame 0x8335b1c, for file example.py, line 34, in __init__ (self=<Test2 at r---Type <return> to continue, or q <return> to quit---
emote 0xb7f3bc5c>), throwflag=0) at ../Python/ceval.c:2666
#33 0x080e11e7 in PyEval_EvalCodeEx (co=0xb7f2fc38, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=0x0, args=0xb7f3dd58, argcount=1,
kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0)
at ../Python/ceval.c:3253
#34 0x08105a61 in function_call (func=<function at remote 0xb7f39764>, arg=
(<Test2 at remote 0xb7f3bc5c>,), kw=0x0) at ../Objects/funcobject.c:526
#35 0x080a464a in PyObject_Call (func=<function at remote 0xb7f39764>, arg=
(<Test2 at remote 0xb7f3bc5c>,), kw=0x0) at ../Objects/abstract.c:2529
#36 0x080a603f in instancemethod_call (func=<function at remote 0xb7f39764>,
arg=(<Test2 at remote 0xb7f3bc5c>,), kw=0x0)
at ../Objects/classobject.c:2578
#37 0x080a464a in PyObject_Call (func=<instancemethod at remote 0xb7f7e7d4>,
arg=(), kw=0x0) at ../Objects/abstract.c:2529
#38 0x080cfa13 in slot_tp_init (self=<Test2 at remote 0xb7f3bc5c>, args=(),
kwds=0x0) at ../Objects/typeobject.c:5657
#39 0x080cdfbc in type_call (type=<value optimized out>, args=(), kwds=0x0)
at ../Objects/typeobject.c:737
#40 0x080a464a in PyObject_Call (func=
<Boost.Python.class at remote 0x8335924>, arg=(), kw=0x0)
---Type <return> to continue, or q <return> to quit---
at ../Objects/abstract.c:2529
#41 0x080dad43 in do_call (f=
Frame 0x82bc184, for file example.py, line 45, in <module> (), throwflag=0)
at ../Python/ceval.c:4231
#42 call_function (f=
Frame 0x82bc184, for file example.py, line 45, in <module> (), throwflag=0)
at ../Python/ceval.c:4036
#43 PyEval_EvalFrameEx (f=
Frame 0x82bc184, for file example.py, line 45, in <module> (), throwflag=0)
at ../Python/ceval.c:2666
#44 0x080e11e7 in PyEval_EvalCodeEx (co=0xb7f33068, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:3253
#45 0x0812c477 in PyEval_EvalCode (co=0xb7f33068, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <class---Type <return> to continue, or q <return> to quit---
obj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}) at ../Python/ceval.c:667
#46 0x0813c010 in run_mod (mod=<value optimized out>,
filename=<value optimized out>, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, flags=0xbffff27c, arena=0x82eca48)
at ../Python/pythonrun.c:1346
#47 0x080700b3 in PyRun_FileExFlags (fp=0x831f158, filename=
0xbffff50f "example.py", start=257, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
---Type <return> to continue, or q <return> to quit---
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, closeit=1, flags=0xbffff27c)
at ../Python/pythonrun.c:1332
#48 0x08070af9 in PyRun_SimpleFileExFlags (fp=0x831f158,
filename=<value optimized out>, closeit=1, flags=0xbffff27c)
at ../Python/pythonrun.c:936
#49 0x0805c069 in Py_Main (argc=2, argv=0xbffff364) at ../Modules/main.c:599
#50 0x0805b25b in main (argc=2, argv=0xbffff364) at ../Modules/python.c:23
(gdb) bt
#0 0x0012e416 in __kernel_vsyscall ()
#1 0x00349e71 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0x0034d34e in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x0038a993 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0x0038f486 in free () from /lib/i386-linux-gnu/libc.so.6
#5 0x0052c941 in operator delete (ptr=0x0)
at ../../.././libstdc++-v3/libsupc++/del_op.cc:44
#6 0x0051139d in _M_dispose (this=0xbfffe34c, __pos=0, __len1=0, __len2=11)
at /home/knappador/Desktop/tarballs/gcc-code-assist-0.1-4.4.4/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:231
#7 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate (this=0xbfffe34c, __pos=0, __len1=0, __len2=11)
at /home/knappador/Desktop/tarballs/gcc-code-assist-0.1-4.4.4/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:465
#8 0x005113ef in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_safe (this=0xbfffe34c, __pos1=0, __n1=0, __s=
0x15e328a "Full Screen", __n2=11)
at /home/knappador/Desktop/tarballs/gcc-code-assist-0.1-4.4.4/i686-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:662
#9 0x01450f5e in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*, unsigned int) ()
from /usr/lib/i386-linux-gnu/libstdc++.so.6
#10 0x015b5f4d in assign (this=0x833fac8)
---Type <return> to continue, or q <return> to quit---
at /usr/include/c++/4.5/bits/basic_string.h:1078
#11 operator= (this=0x833fac8) at /usr/include/c++/4.5/bits/basic_string.h:541
#12 Ogre::GLXGLSupport::addConfig (this=0x833fac8)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/GLX/OgreGLXGLSupport.cpp:164
#13 0x01563b87 in Ogre::GLRenderSystem::initConfigOptions (this=0xb7c24c70)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLRenderSystem.cpp:171
#14 0x0156c813 in Ogre::GLRenderSystem::GLRenderSystem (this=0xb7c24c70)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLRenderSystem.cpp:121
#15 0x01561ca5 in Ogre::GLPlugin::install (this=0xb721c368)
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLPlugin.cpp:49
#16 0x008cf102 in Ogre::Root::installPlugin (this=0xb7c1c260, plugin=
0xb721c368)
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:1287
#17 0x0154bb6c in Ogre::dllStartPlugin ()
at /home/knappador/Projects/PGRE/ogre/RenderSystems/GL/src/OgreGLEngineDll.cpp:41
#18 0x008cf520 in Ogre::Root::loadPlugin (this=0xb7c1c260, pluginName=...)
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:1332
#19 0x008cf930 in Ogre::Root::loadPlugins (this=0xb7c1c260, pluginsfile=...)
---Type <return> to continue, or q <return> to quit---
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:1052
#20 0x008d22d1 in Ogre::Root::Root (this=0xb7c1c260, pluginFileName=...,
configFileName=..., logFileName=...)
at /home/knappador/Projects/PGRE/ogre/OgreMain/src/OgreRoot.cpp:272
#21 0x004e02b7 in OgreEngine::initialise2(std::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#22 0x004e569e in _object* boost::python::detail::invoke<int, void (OgreEngine::*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::arg_from_python<OgreEngine&>, boost::python::arg_from_python<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >(boost::python::detail::invoke_tag_<true, true>, int const&, void (OgreEngine::*&)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::arg_from_python<OgreEngine&>&, boost::python::arg_from_python<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#23 0x004e502c in boost::python::detail::caller_arity<2u>::impl<void (OgreEngine::*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::default_call_policies, boost::mpl::vector3<void, OgreEngine&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::operator()(_object*, _object*) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#24 0x004e4ace in boost::python::objects::caller_py_function_impl<boost::python:---Type <return> to continue, or q <return> to quit---
:detail::caller<void (OgreEngine::*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> >), boost::python::default_call_policies, boost::mpl::vector3<void, OgreEngine&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::operator()(_object*, _object*) ()
from /home/knappador/Desktop/knapper/lib/_ogreutilities_.so
#25 0x00b7b40f in boost::python::objects::function::call(_object*, _object*) const () from /usr/lib/libboost_python-py27.so.1.42.0
#26 0x00b7b5f7 in ?? () from /usr/lib/libboost_python-py27.so.1.42.0
#27 0x00b84342 in boost::python::handle_exception_impl(boost::function0<void>)
() from /usr/lib/libboost_python-py27.so.1.42.0
#28 0x00b7c967 in ?? () from /usr/lib/libboost_python-py27.so.1.42.0
#29 0x080a464a in PyObject_Call (func=
<Boost.Python.function at remote 0x8335530>, arg=
(<Test2 at remote 0xb7f3bc5c>, 'plugins.cfg'), kw=0x0)
at ../Objects/abstract.c:2529
#30 0x080dad43 in do_call (f=
Frame 0x8335b1c, for file example.py, line 34, in __init__ (self=<Test2 at remote 0xb7f3bc5c>), throwflag=0) at ../Python/ceval.c:4231
#31 call_function (f=
Frame 0x8335b1c, for file example.py, line 34, in __init__ (self=<Test2 at remote 0xb7f3bc5c>), throwflag=0) at ../Python/ceval.c:4036
#32 PyEval_EvalFrameEx (f=
Frame 0x8335b1c, for file example.py, line 34, in __init__ (self=<Test2 at r---Type <return> to continue, or q <return> to quit---
emote 0xb7f3bc5c>), throwflag=0) at ../Python/ceval.c:2666
#33 0x080e11e7 in PyEval_EvalCodeEx (co=0xb7f2fc38, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=0x0, args=0xb7f3dd58, argcount=1,
kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0)
at ../Python/ceval.c:3253
#34 0x08105a61 in function_call (func=<function at remote 0xb7f39764>, arg=
(<Test2 at remote 0xb7f3bc5c>,), kw=0x0) at ../Objects/funcobject.c:526
#35 0x080a464a in PyObject_Call (func=<function at remote 0xb7f39764>, arg=
(<Test2 at remote 0xb7f3bc5c>,), kw=0x0) at ../Objects/abstract.c:2529
#36 0x080a603f in instancemethod_call (func=<function at remote 0xb7f39764>,
arg=(<Test2 at remote 0xb7f3bc5c>,), kw=0x0)
at ../Objects/classobject.c:2578
#37 0x080a464a in PyObject_Call (func=<instancemethod at remote 0xb7f7e7d4>,
arg=(), kw=0x0) at ../Objects/abstract.c:2529
#38 0x080cfa13 in slot_tp_init (self=<Test2 at remote 0xb7f3bc5c>, args=(),
kwds=0x0) at ../Objects/typeobject.c:5657
#39 0x080cdfbc in type_call (type=<value optimized out>, args=(), kwds=0x0)
at ../Objects/typeobject.c:737
#40 0x080a464a in PyObject_Call (func=
<Boost.Python.class at remote 0x8335924>, arg=(), kw=0x0)
---Type <return> to continue, or q <return> to quit---
at ../Objects/abstract.c:2529
#41 0x080dad43 in do_call (f=
Frame 0x82bc184, for file example.py, line 45, in <module> (), throwflag=0)
at ../Python/ceval.c:4231
#42 call_function (f=
Frame 0x82bc184, for file example.py, line 45, in <module> (), throwflag=0)
at ../Python/ceval.c:4036
#43 PyEval_EvalFrameEx (f=
Frame 0x82bc184, for file example.py, line 45, in <module> (), throwflag=0)
at ../Python/ceval.c:2666
#44 0x080e11e7 in PyEval_EvalCodeEx (co=0xb7f33068, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:3253
#45 0x0812c477 in PyEval_EvalCode (co=0xb7f33068, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <class---Type <return> to continue, or q <return> to quit---
obj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}) at ../Python/ceval.c:667
#46 0x0813c010 in run_mod (mod=<value optimized out>,
filename=<value optimized out>, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, flags=0xbffff27c, arena=0x82eca48)
at ../Python/pythonrun.c:1346
#47 0x080700b3 in PyRun_FileExFlags (fp=0x831f158, filename=
0xbffff50f "example.py", start=257, globals=
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, locals=
---Type <return> to continue, or q <return> to quit---
{'Test2': <Boost.Python.class at remote 0x8335924>, '__builtins__': <module at remote 0xb7fa011c>, '__file__': 'example.py', '__doc__': None, 'Test': <classobj at remote 0xb7f300ec>, '__name__': '__main__', '__package__': None, 'ogreutils': <module at remote 0xb7f32a1c>}, closeit=1, flags=0xbffff27c)
at ../Python/pythonrun.c:1332
#48 0x08070af9 in PyRun_SimpleFileExFlags (fp=0x831f158,
filename=<value optimized out>, closeit=1, flags=0xbffff27c)
at ../Python/pythonrun.c:936
#49 0x0805c069 in Py_Main (argc=2, argv=0xbffff364) at ../Modules/main.c:599
#50 0x0805b25b in main (argc=2, argv=0xbffff364) at ../Modules/python.c:23

knapper

03-09-2011 23:29:52

Thanks Dermont and all of Ogre of course! I'm assembling a benevolent repayment of my karma debt to the universe in the form of reusable code.

Once I renamed the offending libraries (these ONLY get used for the compile phase of setting up the autocomplete CXX_FLAGS database for gccsense, so they're unnecessary until I need to store CXX_FLAGG on a gigantic new library) everything "just worked" My code and yours.

The app I built was a Gorilla test application. Definitely excited about embedding a perfectly awesome rendering engine into perfectly a arbitrary Python application.

It's really nice that in the meantime of several years and then a lot of work with JScript, Python that my C++ familiarity seems to have gone up a few orders of magnitude without me knowing.

Extra bonus points for Ogre having become remarkably better.

I'm a relatively excellent 3D modeller and texture artist, so It's really nice to know that if I wanted to make a 3d helicopter game where you shoot tanks to a rhythm and kill a boss mechanical dragon at the end with some pleasant superweapon, it'd be completely trivial. I think I said that about 3D pong the last time I was playing with Ogre without actually doing it. Ogre code just somehow makes sense to me now.

I kind of feel like attacking a pack of mastadons with rocks, sticks, and intuition.