btBulletWorldImporter linking problems on Linux (2.80)

aigamedev
Posts: 6
Joined: Fri Sep 28, 2012 9:30 pm

btBulletWorldImporter linking problems on Linux (2.80)

Post by aigamedev »

Hi,

We're trying to link against btBulletWorldImporter on Ubuntu/Linux (works perfectly on Windows, same version of the code) and the linker is reporting a few select undefined references -- which all seem to check-out as present in the .a and .o files (specifically btAngularLimit::set and btBoxShape::btBoxShape). This is version 2.80 of Bullet from the official tarball.

Are any of you aware of issues in this department?

Code: Select all

build/mylib.a(PhysicsEngine.o): In function `physics::PhysicsEngine::createSpringConstraint(btRigidBody&, Situation const&)':
PhysicsEngine.cpp:(.text+0x39dd): undefined reference to `btGeneric6DofSpringConstraint::btGeneric6DofSpringConstraint(btRigidBody&, btTransform const&, bool)'
build/mylib.a(BulletCollisionShapeManager.o): In function `physics::BulletCollisionShapeManager::addBoxShape(Ogre::Vector3 const&)':
BulletCollisionShapeManager.cpp:(.text+0x2c5): undefined reference to `btBoxShape::btBoxShape(btVector3 const&)'
/usr/local/lib/libBulletWorldImporter.a(btBulletWorldImporter.o): In function `btBulletWorldImporter::createBoxShape(btVector3 const&)':
btBulletWorldImporter.cpp:(.text+0x3cdc): undefined reference to `btBoxShape::btBoxShape(btVector3 const&)'
/usr/local/lib/libBulletWorldImporter.a(btBulletWorldImporter.o): In function `btBulletWorldImporter::convertAllObjects(bParse::btBulletFile*)':
btBulletWorldImporter.cpp:(.text+0x8304): undefined reference to `btAngularLimit::set(float, float, float, float, float)'
btBulletWorldImporter.cpp:(.text+0x8e0c): undefined reference to `btAngularLimit::set(float, float, float, float, float)'
We've spent a fair bit of time digging into this, and the usual cause of linker errors in Linux is the ordering of libraries. However, it's not that, and it doesn't seem to be a cyclic dependency either. Bullet's libraries compiled correctly and contain the object files you'd expect, and those in turn contain the functions above...

My only suspicion is that the compilation settings are making the btBulletWorldImporter resolve a different reference... However, the problem is specifically (and only) for the functions above.

Anyway, help is very much appreciated!

Alex
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btBulletWorldImporter linking problems on Linux (2.80)

Post by Erwin Coumans »

Have you tried compiling and linking the regular Bullet 2.80 demos, using any of the available build systems?
Does that work?

It is generally best to simply add the Bullet source code to your own project/build system (and NOT install Bullet system wide in /usr/include etc).
If any Bullet headers/libs are installed system wide, just remove them first.

Thanks,
Erwin
aigamedev
Posts: 6
Joined: Fri Sep 28, 2012 9:30 pm

Re: btBulletWorldImporter linking problems on Linux (2.80)

Post by aigamedev »

Thanks Erwin.

The sample was indeed built successfully so I went back step by step and made sure everything was installed OK, starting from that known point. I'm still not sure what was the problem -- possibly, as you suggested, an installation problem.

Here's the final bullet.pc file that I have now:

Code: Select all

Name: bullet
Description: Bullet Continuous Collision Detection and Physics Library
Requires:
Version: 2.80
Libs: -L/usr/local/lib -lBulletWorldImporter -lBulletSoftBody -lBulletDynamics -lBulletCollision -lBulletFileLoader -lLinearMath
Cflags:  -I/usr/local/include/bullet
Note for any one else, this is not installed by default even if you select install extras in the cmake options. You have to edit it manually. The order of the libraries is very important :-)

Alex