OgreODE on Gentoo Linux

EternalNewbye

19-10-2006 21:27:58

Hi,

I've been trying to get OgreODE to compile on my Gentoo Linux.

For starters, I use gcc 4.1.1, and I've already successfully installed OGRE 1.2.2 and ODE 0.7

I (hopefully) got the last version of OgreODE from http://tuan.kuranes.free.fr/OgreOde.zip.

I had to tweak some settings to get it to start compiling :
Gentoo doesn't use a central OGRE directory to put everything in, so I had to specify the sample directory by hand. And, I wanted to compile it with the ODE sources as they are installed on my system, not the ones that are in the zipfile.
(the point here is to be abble to make some patches and ebuild for gentoo, to get all that automated for other gentoo users)

Since I'm quite new to all the aclocal/configure/automake stuff, it was mostly a trial and error process trying to get a bit farther every time.

First, I changed src/Makefile.am to get it to use the installed ODE (original version is commented out) :
INCLUDES = \
$(STLPORT_CFLAGS) \
${OGRE_CFLAGS} \
-I$(top_srcdir)/include
# -I$(top_srcdir)/ode/include


lib_LTLIBRARIES = libOgreOde_Core.la


libOgreOde_Core_la_SOURCES = \
OgreOdeBody.cpp \
OgreOdeCollision.cpp \
OgreOdeDebugObject.cpp \
OgreOdeEigenSolver.cpp \
OgreOdeEntityInformer.cpp \
OgreOdeGeometry.cpp \
OgreOdeJoint.cpp \
OgreOdeMaintainedList.cpp \
OgreOdeMass.cpp \
OgreOdeMeshInformer.cpp \
OgreOdeSpace.cpp \
OgreOdeStepper.cpp \
OgreOdeUtility.cpp \
OgreOdeWorld.cpp

libOgreOde_Core_la_LIBADD = \
$(OGRE_LIBS) \
/usr/include/libode.a #$(top_srcdir)/ode/ode/src/libode.a


I also changed the last line of prefab/src/configure.am in the same way.

Then, I changed line 29 in configure.ac to have it use /usr/share/doc/ogre-1.2.2_p1/Samples as the root directory for OGRE samples, since that's where they are stored on gentoo (I know there is a command line option for that, but I since I want to make a gentoo only patch, I thought that I might as well change it in the file).

Then I want the way I thought I had to do it :
$ bash autogen.sh
You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4'.
Running aclocal
Running autoheader
Running automake
configure.ac: installing `./install-sh'
configure.ac: installing `./missing'
demos/GranTurismOgre/src/Makefile.am: installing `./depcomp'
Running autoconf
Now you are ready to run ./configure
$ ./configure
...
$ make


So, here is where I bumped into something that I can't solve alone ...
make stops, and tells me nicely :
/bin/sh ../../../libtool --tag=CXX --mode=link g++ -g -O2 -o SimpleScenes -L../../../src -L../../../prefab/src SimpleScenes-SimpleScenesApplication.o SimpleScenes-SimpleScenes.o SimpleScenes-tinystr.o SimpleScenes-tinyxml.o SimpleScenes-tinyxmlerror.o SimpleScenes-tinyxmlparser.o -lOgreMain -lOgreOde_Core -lOgreOde_Prefab
g++ -g -O2 -o .libs/SimpleScenes SimpleScenes-SimpleScenesApplication.o SimpleScenes-SimpleScenes.o SimpleScenes-tinystr.o SimpleScenes-tinyxml.o SimpleScenes-tinyxmlerror.o SimpleScenes-tinyxmlparser.o -L/home/user/ogreode/src -L/home/user/ogreode/prefab/src -L/var/tmp/portage/devil-1.6.7-r1/work/DevIL-1.6.7/src-IL/src /home/user/ogreode/prefab/src/.libs/libOgreOde_Prefab.so /home/user/ogreode/src/.libs/libOgreOde_Core.so /usr/lib/libOgreMain.so /usr/lib/libfreetype.so /usr/lib/libzzip.so -lCg /usr/lib/libILU.so /usr/lib/libIL.so /usr/lib/libpng12.so /usr/lib/libjpeg.so -lboost_thread-mt -lpthread -lz -ldl
SimpleScenes-SimpleScenesApplication.o: In function `SimpleScenesApplication::createScene()':
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:114: undefined reference to `Ogre::Light::setDirection(float, float, float)'
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:116: undefined reference to `Ogre::Light::setSpecularColour(float, float, float)'
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:122: undefined reference to `Ogre::Camera::setPosition(float, float, float)'
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:123: undefined reference to `Ogre::Camera::lookAt(float, float, float)'
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:147: undefined reference to `Ogre::Plane::Plane(Ogre::Vector3 const&, float)'
SimpleScenes-SimpleScenesApplication.o: In function `SimpleScenesApplication::frameEnded(Ogre::FrameEvent const&, Ogre::InputReader*)':
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:280: undefined reference to `Ogre::Camera::setPosition(float, float, float)'
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenesApplication.cpp:281: undefined reference to `Ogre::Camera::lookAt(float, float, float)'
SimpleScenes-SimpleScenesApplication.o: In function `SimpleScenes_Zombie::frameStarted(float, Ogre::InputReader*)':
../include/SimpleScenes_Zombie.h:201: undefined reference to `Ogre::AnimationState::addTime(float)'
SimpleScenes-SimpleScenesApplication.o: In function `SimpleScenes_Zombie::frameEnded(float, Ogre::InputReader*)':
../include/SimpleScenes_Zombie.h:244: undefined reference to `Ogre::Camera::getCameraToViewportRay(float, float) const'
../include/SimpleScenes_Zombie.h:283: undefined reference to `OgreOde_Prefab::OgreOdeDotLoader::loadRagdoll(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, OgreOde_Prefab::Ragdoll*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
SimpleScenes-SimpleScenesApplication.o: In function `ExampleFrameListener::updateStats()':
/usr/share/doc/ogre-1.2.2_p1/Samples/Common/include/ExampleFrameListener.h:71: undefined reference to `Ogre::StringConverter::toString(float, unsigned short, unsigned short, char, std::_Ios_Fmtflags)'
/usr/share/doc/ogre-1.2.2_p1/Samples/Common/include/ExampleFrameListener.h:72: undefined reference to `Ogre::StringConverter::toString(float, unsigned short, unsigned short, char, std::_Ios_Fmtflags)'
/usr/share/doc/ogre-1.2.2_p1/Samples/Common/include/ExampleFrameListener.h:74: undefined reference to `Ogre::StringConverter::toString(float, unsigned short, unsigned short, char, std::_Ios_Fmtflags)'
/usr/share/doc/ogre-1.2.2_p1/Samples/Common/include/ExampleFrameListener.h:76: undefined reference to `Ogre::StringConverter::toString(float, unsigned short, unsigned short, char, std::_Ios_Fmtflags)'
SimpleScenes-SimpleScenesApplication.o: In function `changeCar':
../include/SimpleScenes_Buggy.h:104: undefined reference to `OgreOde_Prefab::OgreOdeDotLoader::loadVehicle(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
SimpleScenes-SimpleScenesApplication.o: In function `SimpleScenes_Buggy':
../include/SimpleScenes_Buggy.h:104: undefined reference to `OgreOde_Prefab::OgreOdeDotLoader::loadVehicle(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
SimpleScenes-SimpleScenes.o: In function `SimpleScenes::createRagDoll()':
/home/user/ogreode/demos/SimpleScenes/src/SimpleScenes.cpp:151: undefined reference to `OgreOde_Prefab::OgreOdeDotLoader::loadRagdoll(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, OgreOde_Prefab::Ragdoll*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `non-virtual thunk to Ogre::SimpleRenderable::getWorldPosition() const'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `non-virtual thunk to Ogre::SimpleRenderable::getWorldTransforms(Ogre::Matrix4*) const'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `non-virtual thunk to Ogre::SimpleRenderable::getLights() const'
/home/user/ogreode/prefab/src/.libs/libOgreOde_Prefab.so: undefined reference to `Ogre::ShadowCaster::extrudeBounds(Ogre::AxisAlignedBox&, Ogre::Vector4 const&, float) const'
/home/user/ogreode/prefab/src/.libs/libOgreOde_Prefab.so: undefined reference to `Ogre::Entity::getShadowVolumeRenderableIterator(Ogre::ShadowTechnique, Ogre::Light const*, Ogre::HardwareIndexBufferSharedPtr*, bool, float, unsigned long)'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `non-virtual thunk to Ogre::SimpleRenderable::getRenderOperation(Ogre::RenderOperation&)'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `Ogre::Quaternion::Slerp(float, Ogre::Quaternion const&, Ogre::Quaternion const&, bool)'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `non-virtual thunk to Ogre::SimpleRenderable::getWorldOrientation() const'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `Ogre::Pass::setSelfIllumination(float, float, float)'
/home/user/ogreode/prefab/src/.libs/libOgreOde_Prefab.so: undefined reference to `Ogre::MovableObject::getDarkCapBounds(Ogre::Light const&, float) const'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `non-virtual thunk to Ogre::SimpleRenderable::getMaterial() const'
/home/user/ogreode/src/.libs/libOgreOde_Core.so: undefined reference to `Ogre::MovableObject::getShadowVolumeRenderableIterator(Ogre::ShadowTechnique, Ogre::Light const*, Ogre::HardwareIndexBufferSharedPtr*, bool, float, unsigned long)'
collect2: ld returned 1 exit status
make[4]: *** [SimpleScenes] Error 1
make[4]: Leaving directory `/home/user/ogreode/demos/SimpleScenes/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/user/ogreode/demos/SimpleScenes'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/user/ogreode/demos'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/user/ogreode'
make: *** [all] Error 2


So, what I can guess without my head hurting too much, is we have some linker problem somewhere ... moreover, the problem seems to be with the OGRE part and not the ODE one.

Before anyone asks the question, yes, I've already compiled stuff (the tutorial apps) against OGRE, and it seemed to work well as far as I could see.

Has anyone got an idea what to try now ?

Thanks for reading this far ...

PS : I am also wondering about the $(STLPORT_CFLAGS) ... I don't use STLport, and I think its use for OGRE is optional on linux. Is it safe to eliminate the variable ?

EternalNewbye

19-10-2006 22:23:53

Well, seems I figured things out for myself ... damn, writing things down helped me to look at things from a different perspective.

I didn't think about the fact that I compiled OGRE with double precision.
And the SimpleScenesApplication headers don't define the OGRE_DOUBLE_PRECISION variable ... such a trivial mistake.

I'll see what I can do to enable it, and then I hope it will compile.

tuan kuranes

20-10-2006 13:00:17

best would be to have configure let user specify where ode is.

Check also if ODE is in double or single precision, that might be the problem (I doubt simplesceneapplication needs to redefine the ogre double precision thing... unless you have mutliple Ogre.h on your system and compile against one and link against another)

EternalNewbye

20-10-2006 14:08:54

Thanks for your reply.

best would be to have configure let user specify where ode is.

Well, as I said, I'm trying to do something Gentoo specific. And this distrib always puts it in the same location. But then, I could do it your way ... and have the Gentoo ebuild script pass the correct location to configure.
How should I do that ?
Should I do it the same way as the location of the Ogre sample directory is handled in configure.ac ?

Check also if ODE is in double or single precision, that might be the problem (I doubt simplesceneapplication needs to redefine the ogre double precision thing... unless you have mutliple Ogre.h on your system and compile against one and link against another)

ODE is in double-precision too. But the problem is with OGRE, and the errors look very much like the ones you get when you don't define OGRE_DOUBLE_PRECISION before including OGRE headers when compiling the tutorials (see below).

In fact, Ogre headers define OGRE_DOUBLE_PRECISION to 0 if it hasn't already been defined to 1 before their inclusion.
(Right now, I can't tell the header file where it is done, but I'll post it next time I boot under linux).

Anyways, I had to define the macro to get the Ogre tutorials to compile, so I guessed that was the problem since SimpleScenes uses a structure similar to the tutos (inclusion of ExampleApplication.h).

Moreover, I seem to have problems AC_DEFINE. When adding AC_DEFINE ([OGRE_DOUBLE_PRECISION], 1, [some comment]) line to configure.ac, I don't have the macro defined in the generated config.h, but a line similar to this one :
/* some comment */
/* #undef OGRE_DOUBLE_PRECISION */


More news when I've tried compiling it with the macro manually set to 1 (should be the day after tomorrow).

EternalNewbye

22-10-2006 21:30:14

More news when I've tried compiling it with the macro manually set to 1 (should be the day after tomorrow).

So, setting OGRE_DOUBLE_PRECISION to 1 did the trick.

I ran into two problems that I solved ... well, not really solved them the best way possible, but it got the code to compile.

1. In the file src/OgreOdeMeshInformer.cpp, I had to change line 145 into :
//posElem->baseVertexPointerToElement(vertex, &pReal);
float myfloat = (float) *pReal;
float* floataddr = &myfloat;

posElem->baseVertexPointerToElement(vertex, &floataddr);
*pReal = *floataddr;

It doen't look nice and there's a good chance it's bugged.
The problem with the line was that with double precision, pReal is a pointer to a Real that is in fact a double, and baseVertexPointerToElement wants the address of a pointer to a float.

2. I had to add OgreOdeDotLoader.cpp to prefab/src/Makefile.am since it was misteriously absent from it ...
...

libOgreOde_Prefab_la_SOURCES = \
OgreOdeDotLoader.cpp \
OgreOdeVehicle.cpp \
OgreOdeRagdoll.cpp \
...


And now, everything compiles fine ... but doesn't run.

First, all three demos crashed with the exact same error :
Parsing script ogreodedemos.overlay
An exception has occured: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: OverlayElement::setMaterialName
Description: Could not find material Core/StatsBlockCenter.
File: OgreOverlayElement.cpp
Line: 317
Stack unwinding: <<beginning of stack>>


So I created a dummy.material in my ressource directory where I declared two dummy materials called Core/StatsBlockCenter and Core/StatsBlockBorder, because I got the same problem with it too.

And then all three programs started crashing with :
Parsing script ogreodedemos.overlay
An exception has occured: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: TextAreaOverlayElement::setFontName
Description: Could not find font BlueHighway.
File: OgreTextAreaOverlayElement.cpp
Line: 337
Stack unwinding: <<beginning of stack>>


My ressource.cfg is
FileSystem=/usr/share/OGRE/Media
FileSystem=/usr/share/OGRE/Media/gui
FileSystem=/home/user/ogreode/demos/Media


I have three files bluehighway-8.font, bluehighway-10.font and bluehighway-12.font in /usr/share/OGRE/Media/gui.
I also tried to copy them into /home/user/ogreode/demos/Media ... but to no use.

Any idea what I can do now ?

Moreover, all three programs ouput those two errors too when parsing the file zombie.material, without crashing :
Parsing script zombie.material
Error in material Zombie at line 9 of zombie.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeight has not been defined.
Error in material Zombie at line 21 of zombie.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeightShadowCaster has not been defined.

tuan kuranes

24-10-2006 08:27:33

1. Did you try CVS ? that file isn't anymore part of compilation... it's now OgreOdeEntityInformer and this is already fixed.

2. Indeed I forgot that... but next OgreOde version has that changed... as loader is now a separated library (make a lot more sense and room for binary loader, collada loader, xode, etc...)

3. It doesn't run because you're missing a correct resources.cfg next to the binary. It needs a lot more info. copy one from the Ogre demos and add a
[OgreODE] section under which you add your paths


[OgreODE]
FileSystem=/home/user/ogreode/demos/Media

EternalNewbye

24-10-2006 10:00:23

Thank you !

I didn't try the CVS, but I will very soon.

I thought my resource.cfg was OK, since it worked for the tutos as is. I remember trying to find a more detailed example of how to write one, but I gave up since everything seemed to work. Sometimes, I am not patient enough ...