[Solved] setCustomForceAndTorqueCallback / boost / linux

sausage

17-12-2008 03:04:42

Hi Guys. I've spent many days on this rather than bother anyone, but I need some help if I can.

Trying to do a setCustomForceAndTorqueCallback() on my object which is just a sphere body.

I had compilation problems getting the syntax right but the posts here helped me sort that out.

But now I get a crash when I run the program.

This post gives me the impression that my code might be alright, but boost may be the cause: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=8055

I did follow the suggestion and I renamed my 'detail' folder under boost to '_detail', but this gave me a lot of errors so I put it back.

According to rpm -qa | grep boost, my version is 1.3.4 that came with fedora core 9.

Would someone be able to lend me some suggestions as to how I can start to resolve the problem? All my OgreNewt experiements have worked great until the custom callback additions.

My basic code section are:

sphere->body->setCustomForceAndTorqueCallback(boost::bind( &OgreNewtonFrameListener::userCallback, this, _1));

or

sphere->body->setCustomForceAndTorqueCallback<OgreNewtonFrameListener>( &OgreNewtonFrameListener::userCallback, (OgreNewtonFrameListener*) this );

Either syntax above compiles file. And then:

void OgreNewtonFrameListener::userCallback(OgreNewt::Body* me)
{
Ogre::Vector3 pos(0.5,0.5,0.5);

me->setForce(pos);

}



The bug report from the crash is (excuse the length):

System: Linux 2.6.26 #2 SMP Fri Aug 29 04:25:51 EST 2008 i686
X Vendor: The X.Org Foundation
X Vendor Release: 10499901
Selinux: No
Accessibility: Disabled
GTK+ Theme: Clearlooks
Icon Theme: gnome

Memory status: size: 98377728 vsize: 98377728 resident: 46342144 share: 18100224 rss: 46342144 rss_rlim: 4294967295
CPU usage: start_time: 1229465667 rtime: 61 utime: 47 stime: 14 cutime:0 cstime: 0 timeout: 0 it_real_value: 0 frequency: 100

Backtrace was generated from '/usr/libexec/<unknown>'

[?1034h[Thread debugging using libthread_db enabled]
[New Thread 0xb77f5720 (LWP 5359)]
0xb7fde424 in __kernel_vsyscall ()
#0 0xb7fde424 in __kernel_vsyscall ()
#1 0x00d95b43 in __waitpid_nocancel () from /lib/libpthread.so.0
#2 0x0258bd97 in g_spawn_sync () from /lib/libglib-2.0.so.0
#3 0x0258c0dc in g_spawn_command_line_sync () from /lib/libglib-2.0.so.0
#4 0xb72a8253 in ?? () from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
#5 0xb72a87d8 in ?? () from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
#6 0x0000006d in ?? ()
#7 0xb72a8e23 in google_breakpad::ExceptionHandler::HandleException ()
from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
#8 <signal handler called>
#9 0x0812251f in void boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to<boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> > >(boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> >)::stored_vtable ()
#10 0x08b86d70 in ?? ()
#11 0xbfcdbd54 in ?? ()
#12 0xbfcdbcf8 in ?? ()
#13 0xbfcdbcdc in ?? ()
#14 0xb7f92648 in ?? () from /usr/local/lib/libOgreNewt.so
#15 0x080535f0 in ?? ()
#16 0x08122518 in guard variable for void boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to<boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> > >(boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> >)::stored_vtable ()
#17 0xbfcdbcec in ?? ()
#18 0xb7f7e669 in boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to_own () from /usr/local/lib/libOgreNewt.so
#19 0xb7f7e6b3 in boost::function1<void, OgreNewt::Body*, std::allocator<void> >::function1 () from /usr/local/lib/libOgreNewt.so
#20 0xb7f7e6de in boost::function<void ()(OgreNewt::Body*), std::allocator<void> >::function () from /usr/local/lib/libOgreNewt.so
#21 0xb7f7ef60 in boost::function<void ()(OgreNewt::Body*), std::allocator<void> >::operator= () from /usr/local/lib/libOgreNewt.so
#22 0xb7f7d33d in OgreNewt::Body::setCustomForceAndTorqueCallback ()
from /usr/local/lib/libOgreNewt.so
#23 0x080548c0 in OgreNewtonFrameListener (this=0x8e31ed0, win=0x89b5458,
cam=0x8b965b0, mgr=0x8b86d70, W=0x812b1f0, ncam=0x8e31220)
at OgreNewtonFrameListener.cpp:108
#24 0x0804d534 in OgreNewtonApplication::createFrameListener (this=0xbfcdbeb4)
at OgreNewtonApplication.cpp:79
#25 0x08051220 in ExampleApplication::setup (this=0xbfcdbeb4)
at ./ExampleApplication.h:140
#26 0x0804d40d in main () at ./ExampleApplication.h:89

Thread 1 (Thread 0xb77f5720 (LWP 5359)):
#0 0xb7fde424 in __kernel_vsyscall ()
No symbol table info available.
#1 0x00d95b43 in __waitpid_nocancel () from /lib/libpthread.so.0
No symbol table info available.
#2 0x0258bd97 in g_spawn_sync () from /lib/libglib-2.0.so.0
No symbol table info available.
#3 0x0258c0dc in g_spawn_command_line_sync () from /lib/libglib-2.0.so.0
No symbol table info available.
#4 0xb72a8253 in ?? () from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
No symbol table info available.
#5 0xb72a87d8 in ?? () from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
No symbol table info available.
#6 0x0000006d in ?? ()
No symbol table info available.
#7 0xb72a8e23 in google_breakpad::ExceptionHandler::HandleException ()
from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
No symbol table info available.
#8 <signal handler called>
No symbol table info available.
#9 0x0812251f in void boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to<boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> > >(boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> >)::stored_vtable ()
No symbol table info available.
#10 0x08b86d70 in ?? ()
No symbol table info available.
#11 0xbfcdbd54 in ?? ()
No symbol table info available.
#12 0xbfcdbcf8 in ?? ()
No symbol table info available.
#13 0xbfcdbcdc in ?? ()
No symbol table info available.
#14 0xb7f92648 in ?? () from /usr/local/lib/libOgreNewt.so
No symbol table info available.
#15 0x080535f0 in ?? ()
__ioinit = {static _S_refcount = <optimized out>,
static _S_synced_with_stdio = <optimized out>}
OgreNewt::frameCount = 0
#16 0x08122518 in guard variable for void boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to<boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> > >(boost::_bi::bind_t<void, boost::_mfi::mf1<void, OgreNewtonFrameListener, OgreNewt::Body*>, boost::_bi::list2<boost::_bi::value<OgreNewtonFrameListener*>, boost::arg<1> (*)()> >)::stored_vtable ()
No symbol table info available.
#17 0xbfcdbcec in ?? ()
No symbol table info available.
#18 0xb7f7e669 in boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to_own () from /usr/local/lib/libOgreNewt.so
No symbol table info available.
#19 0xb7f7e6b3 in boost::function1<void, OgreNewt::Body*, std::allocator<void> >::function1 () from /usr/local/lib/libOgreNewt.so
No symbol table info available.
#20 0xb7f7e6de in boost::function<void ()(OgreNewt::Body*), std::allocator<void> >::function () from /usr/local/lib/libOgreNewt.so
No symbol table info available.
#21 0xb7f7ef60 in boost::function<void ()(OgreNewt::Body*), std::allocator<void> >::operator= () from /usr/local/lib/libOgreNewt.so
No symbol table info available.
#22 0xb7f7d33d in OgreNewt::Body::setCustomForceAndTorqueCallback ()
from /usr/local/lib/libOgreNewt.so
No symbol table info available.
#23 0x080548c0 in OgreNewtonFrameListener (this=0x8e31ed0, win=0x89b5458,
cam=0x8b965b0, mgr=0x8b86d70, W=0x812b1f0, ncam=0x8e31220)
at OgreNewtonFrameListener.cpp:108
No locals.
#24 0x0804d534 in OgreNewtonApplication::createFrameListener (this=0xbfcdbeb4)
at OgreNewtonApplication.cpp:79
No locals.
#25 0x08051220 in ExampleApplication::setup (this=0xbfcdbeb4)
at ./ExampleApplication.h:140
pluginsPath = {static npos = 4294967295,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x8157f3c "plugins.cfg"}}
carryOn = <value optimized out>
#26 0x0804d40d in main () at ./ExampleApplication.h:89
app = {<ExampleApplication> = {_vptr.ExampleApplication = 0x8110f48,
mRoot = 0x8157f90, mCamera = 0x8b965b0, mSceneMgr = 0x8b86d70,
mFrameListener = 0x0, mWindow = 0x89b5458, mResourcePath = {
static npos = 4294967295,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x81221dc ""}}},
m_World = 0x812b1f0, msnCam = 0x8e31220, mNewtonListener = 0xbfcdbef8}
#0 0xb7fde424 in __kernel_vsyscall ()
The program is running. Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]


----------- .xsession-errors (6690 sec old) ---------------------
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: inotify successfully used for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::addEntry: Added File "/usr/share/mime/image/x-win-bitmap.xml" for "" ["KDirWatch-1"]
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: trying to use inotify for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: inotify successfully used for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::addEntry: Added File "/usr/share/mime/image/x-wmf.xml" for "" ["KDirWatch-1"]
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: trying to use inotify for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: inotify successfully used for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::addEntry: Added File "/usr/share/mime/image/x-xbitmap.xml" for "" ["KDirWatch-1"]
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: trying to use inotify for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: inotify successfully used for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::addEntry: Added File "/usr/share/mime/image/x-xcf.xml" for "" ["KDirWatch-1"]
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: trying to use inotify for monitoring
kded(2773)/kio (KDirWatch) KDirWatchPrivate::useINotify: inotify successfully used for monitoring
...Too much output, ignoring rest...
--------------------------------------------------



Hopefully this means something to those with a bit more experience...

sausage

18-12-2008 23:06:34

I think my answer may be held here:

http://www.ogre3d.org/phpBB2addons/view ... ight=boost

I'll try this out this evening.

sausage

22-12-2008 01:52:50

As suspected, boost was the problem and by following the instructions at the post above, my program runs without error.

I had to rename my offical boost folder at: /usr/includes/boost to _boost and them copy the boost folder from OgreNewt.

The OgreNewt version one was a heck of a lot smaller than the original so it may have some implication down the track... who knows.

So what version is the one that comes with OgreNewt?...