Linker errors when compiling in double precision

Post Reply
Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Linker errors when compiling in double precision

Post by Marcell »

Hello!

I just downloaded a fresh version of 2.82 BP and I'm trying to get a project to compile on a 64 bit Linux Ubuntu 14.04. I compiled Bullet with the USE_DOUBLE_PRECISION flag enabled and included a

#define BT_USE_DOUBLE_PRECISION 1

line right into the btScalar.h. This solved most of the occuring issues, except for a few that I cannot seem to wrap my head around. They all seem to be similar, so I will focus on one of them.
Here is the error I get when compiling:
Joint.cpp:5: error: undefined reference to `btRigidBody::btRigidBody(double, btMotionState*, btCollisionShape*, btVector3 const&)'
The line of code that causes this is:

Code: Select all


Joint::Joint() : collisionShape(shape), tempRigidBody(1.0, &ms, &collisionShape, inertia), joint(0)
{
	init();
}

class Joint
{
	btVector3 inertia;
	btDefaultMotionState ms;
	btBoxShape collisionShape;
	btVector3 shape;
	btRigidBody tempRigidBody;
}
I'm calling the btRigidBody constructor when I initialize tempRigidBody. I don't understand why it can't find it. I'm seeing this line in btRigidBody.h:

Code: Select all

btRigidBody(	btScalar mass, btMotionState* motionState, btCollisionShape* collisionShape, const btVector3& localInertia=btVector3(0,0,0));
and it does not depend on BT_USE_DOUBLE_PRECISION.

Another place, where I call the same constructor with a btScalar

Code: Select all

btScalar mass = 1.0;
rigidBody = new btRigidBody(mass, &motionState, collisionShape, inertia);
results in the same linker error shown above. I am sure that btScalar is of type double though, because when I remobe the BT_USE_DOUBLE_PRECISION definition, the compiler fails at a lot more places. Can anyone help me please? I'm stuck at this point.

Marcell
Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Re: Linker errors when compiling in double precision

Post by Marcell »

It seems that I managed to "solve" the issue, as the errors have disappeared. The problem must have been located in the build process of the BP library, but I cannot pinpoint the exact problem. This is the routine that worked for me:

unpack the tar archive
open bullet-2.82-r2704/src/LinearMath/btScalar.h and chuck in #define BT_USE_DOUBLE_PRECISION 1
open cmake and point the "source" box to the root of the folder that was created
point the "build" box to the build folder underneath the root
press configure
uncheck everything
check INSTALL_LIBS and USE_DOUBLE_PRECISION
press configure
press generate
close cmake and open a shell in bullet-2.82-r2704/build
make
sudo make install did not place the libraries anywhere, so I manually copied libBullet*.a and libLinearMath.a to /usr/local/lib

enjoy
Post Reply