How to Build OgreBullet step by step on Ubuntu 12.10 (Fixed)

zeSoup

16-06-2013 12:34:45

Hello there folks,

so i've been trying to use OgreBullet (latest 2013-06-04) for nearly a week now and i do find myself unable to do it. (yeah i even poked alexey)

One may add that i'm somewhat new to the whole make, generate, install usage.

This is a horribly long time, even for me, but given that Ogre and Bullet themselves went considerably smoot i think a step by step introduction would help as most others refer to files i dont have, OS's i dont use or commands i cant execute.
So, what i'm intending to do in this thread is writing chain of commands (explained) that allow one to get OgreBullet up and running. Obviously many in here have no problems since it's somewhat easy. Well, at least i still fail :)

(If anyone finds something done wrong, please give me a shout, i'll fix the chain below accordingly)


PreOgreBullet
-> get and install Ogre
1.7.4 here. Propably gonna update soon but while i have no errors with ogre itself, lets keep it that way

-> get and install Bullet
bullet-2.81-rev2613
Make sure to build bullet with extras

OgreBullet
get a Copy from OgreBullet [https://bitbucket.org/alexeyknyshev/ogrebullet]
i myself felt attracted to the download button on the frontpage.
Obtain .zip file
Unzipp it to a nice area

right now there's a copy of the ogrebullet source. Buildingtime.
now running through quite some posts, some suggest running autogen.sh which sounds like a file - i dont have it.
But i do have cMake which runs, sounds reasonable. cMake is always a good idea in new source.

>cmake . -G "Unix Makefiles"
tell cmake (should be installed) to configure the local source. "." is "here", -G "Unix Makefiles" tells how.

This should not yet generate any errors.
> make -j4 [tell make to build the code, 4jobs at a time, ppl tend to like that]
Shouldnt make any errors aswell. two rather big files are beeing built.
> sudo make install
Copy[Install] the essential parts to where they should go.

Will copy the built objectfiles to their usual space.
/usr/local/lib/libOgreBulletCollisions.a
/usr/local/lib/libOgreBulletDynamics.a

Now all headerfiles will be Installed.
/usr/local/include/OgreBullet/*

Basically thats about as far as i made it.

It does sound horribly installed by now, altough i did find ppl on the forum having pkg-configs up and running for ogrebullet. no .pc file could be found for me, i guess they wrote 'em themselves.

Next up, i tried to compile a code with it. Basically importing a random file of ogrebullet, linking all libs to it and see if it works.

I added
#include <btBulletDynamicsCommon.h>
#include <Utils/OgreBulletCollisionsMeshToShapeConverter.h>
to my file, made a class inherit of StaticMeshToShapeConverter [propably bad idea but as i want to see if it works and mesh to shape is what i'm looking for i expect this to be a good idea]

now link some libs to it.

my Makefile contained `pkg-config ---libs -cflags OGRE OIS bullet` allready, i added everything that came to mind for ogrebullet.

-lOgreBulletDynamics
-lOgreBulletCollisions
-L/usr/local/include/bullet/BulletCollision/CollisionShapes/
-I/usr/local/include
-I/usr/local/include/OgreBullet/Dynamics
-I/usr/local/include/OGRE
-I/usr/local/include/bullet
-I/usr/local/include/OgreBullet/
-I/usr/local/include/OgreBullet/Collisions/

this may look a little bruteforceincluded. but lets face it, i'm trying to get it working for a while now, something just keep beeing wrong :)

output is as follows

/usr/local/lib/libOgreBulletCollisions.a(OgreBulletCollisionsMeshToShapeConverter.cpp.o): In function `OgreBulletCollisions::VertexIndexToShape::createConvex()':
OgreBulletCollisionsMeshToShapeConverter.cpp:(.text+0x1420): undefined reference to `btConvexHullShape::btConvexHullShape(float const*, int, int)'
OgreBulletCollisionsMeshToShapeConverter.cpp:(.text+0x1697): undefined reference to `btShapeHull::btShapeHull(btConvexShape const*)'
OgreBulletCollisionsMeshToShapeConverter.cpp:(.text+0x16bb): undefined reference to `btShapeHull::buildHull(float)'
OgreBulletCollisionsMeshToShapeConverter.cpp:(.text+0x16da): undefined reference to `btShapeHull::numTriangles() const'
OgreBulletCollisionsMeshToShapeConverter.cpp:(.text+0x1787): undefined reference to `btShapeHull::numIndices() const'
OgreBulletCollisionsMeshToShapeConverter.cpp:(.text+0x1834): undefined reference to `btShapeHull::numVertices() const'


so this would be bullet files.. my bullet is working, it's working fine, why would ogrebullet complain?

Any ideas? :)

Edit:
Problem Fixed

Jesuso

21-06-2013 19:44:45

Hello zeSoup.

Looks like after a few patches on either ogrebullet or bullet itself some files got moved around and that messed up the include paths, I had the exact same problem but on windows, you can try and try until you add the correct path manually into your makefile or your includes file, but to fix it you just have to change the incorrect #import at the file that is causing the error. Which is OgreBulletCollisionsMeshToShapeConverter.cpp.

C:\OgreSDK\ogrebullet\Collisions\src\Utils\OgreBulletCollisionsMeshToShapeConverter.cpp:34:47: fatal error: ConvexDecomposition/ConvexBuilder.h: No such file or directory

If you check the cmake file that handles imports you will see that it is including the path "bullet/Extras/ConvexDecomposition", which leads to an error because OgreBulletCollisionsMeshToShapeConverter.cpp would look the include at "bullet/Extras/ConvexDecomposition/ConvexDecomposition/ConvexBuilder.h" (Among many others) which of course doesn't exists.

All you have to do is TEMPORARY change:

#include "ConvexDecomposition/ConvexBuilder.h"

to:

#include "ConvexBuilder.h"

inside "OgreBulletCollisionsMeshToShapeConverter.cpp"

Hope this also works for you!

> Jesuso

dermont

22-06-2013 04:03:10

@zeSoup
Maybe you could upload your Makefile.

As a guess you could try changing the link order of your libraries so the OgreBullet libs come before the bullet libs.

zeSoup

27-06-2013 16:04:22

Hey guys, sorry for the late reply, this thread was on moderator-hold for about a week i think and i somewhat forgot to keep an eye on it :)

The issue did get fixed. As jensuso mentioned i did have to link the ogrebullet extras concerning ConvexDecomposition.
But even worse, i had to build it first since it really slipped my mind that bulletextras are required. - thanks for that :)


(editing the threadhead aswell. things are working for me now. if anyone with further issues wants to hijack this thread for startup issues feel free to :) )

affentanz

19-09-2013 16:00:59

I have some trouble with OgreBullet an Ubuntu 12.10 (64Bit), too. I've selfcompiled Ogre 1.8.1, Bullet 2.8.1-rev2613 (with extra libs) and OgreBullet (current git master, commit 10bdcf0). I had no problems with compiling and installation. Ogre works fine, but when I include the "OgreBulletDynamicsRigidBody.h", I got this:


/usr/local/lib/libBulletDynamics.a(btTypedConstraint.o): In function `btRigidBody::~btRigidBody()':
btTypedConstraint.cpp:(.text._ZN11btRigidBodyD2Ev[_ZN11btRigidBodyD5Ev]+0x86): undefined reference to `btCollisionObject::~btCollisionObject()'
btTypedConstraint.cpp:(.text._ZN11btRigidBodyD2Ev[_ZN11btRigidBodyD5Ev]+0x70): undefined reference to `btCollisionObject::~btCollisionObject()'
/usr/local/lib/libBulletDynamics.a(btTypedConstraint.o): In function `btRigidBody::~btRigidBody()':
btTypedConstraint.cpp:(.text._ZN11btRigidBodyD0Ev[_ZN11btRigidBodyD0Ev]+0x62): undefined reference to `btCollisionObject::~btCollisionObject()'
btTypedConstraint.cpp:(.text._ZN11btRigidBodyD0Ev[_ZN11btRigidBodyD0Ev]+0x8e): undefined reference to `btCollisionObject::~btCollisionObject()'
/usr/local/lib/libBulletDynamics.a(btRigidBody.o): In function `btRigidBody::serialize(void*, btSerializer*) const':
btRigidBody.cpp:(.text+0xed): undefined reference to `btCollisionObject::serialize(void*, btSerializer*) const'
/usr/local/lib/libBulletDynamics.a(btRigidBody.o): In function `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)':
btRigidBody.cpp:(.text+0x2f6d): undefined reference to `btCollisionObject::btCollisionObject()'
btRigidBody.cpp:(.text+0x3108): undefined reference to `btCollisionObject::~btCollisionObject()'
/usr/local/lib/libBulletDynamics.a(btRigidBody.o): In function `btRigidBody::btRigidBody(btRigidBody::btRigidBodyConstructionInfo const&)':
btRigidBody.cpp:(.text+0x3135): undefined reference to `btCollisionObject::btCollisionObject()'
btRigidBody.cpp:(.text+0x3193): undefined reference to `btCollisionObject::~btCollisionObject()'
/usr/local/lib/libBulletDynamics.a(btRigidBody.o):(.rodata._ZTI11btRigidBody[_ZTI11btRigidBody]+0x10): undefined reference to `typeinfo for btCollisionObject'


Does anybody know a solution?

AlexeyKnyshev

19-09-2013 22:35:44

Simple so... Linker can't find symbols for some bullet related functions / methods. Looks like you are not linking BulletCollision. Check you linker options that they contain something like '-lBulletCollision'.

affentanz

20-09-2013 06:34:49

My includes:


/usr/include/ois
/usr/local/include/OgreBullet
/usr/local/include/bullet
/usr/local/include/OgreBullet/Dynamics
/usr/local/include/OgreBullet/Collisions
/usr/local/include/OGRE/Terrain
/usr/local/include/CEGUI
/usr/local/include/OGRE


My linker:


OgreMain
BulletCollision
BulletDynamics
LinearMath
GIMPACTUtils
ConvexDecomposition
OgreBulletCollisions
OgreBulletDynamics
OgreTerrain
CEGUIBase
CEGUIOgreRenderer
OIS


Seems to be ok?

AlexeyKnyshev

21-09-2013 05:54:40

Check real linker flags passed as arguments to g++. There's problem with BulletCollision lib.

affentanz

21-09-2013 13:55:37


g++ -o "application" ./src/AbstractScene.o ./src/Framework.o ./src/InputHandler.o ./src/MainMenuDlg.o ./src/Scene.o ./src/StateManager.o ./src/TerrainScene.o ./src/Timer.o ./main.o -lOgreMain -lBulletCollision -lBulletDynamics -lLinearMath -lGIMPACTUtils -lConvexDecomposition -lOgreBulletCollisions -lOgreBulletDynamics -lOgreTerrain -lCEGUIBase -lCEGUIOgreRenderer -lOIS


Can't see anything wrong... Maybe I have to include every single subfolder of bullet? Or should I switch to a different version of ogrebullet?

AlexeyKnyshev

23-09-2013 21:56:55

Undefined ref problem is common signal that there is not implementation of some function. In most of all cases it could appear when you forget to implement some forward declared and wherever called function / method. Or external library (object ) file not found.