I’ve been working on this project1 where I’m compiling different C++ libraries and statically linking them together. I had problems with undefined symbols. And the undefined symbols were mangled C++ symbols. If you didn’t know, C++ creates “mangled” symbols for all your human readable symbols to solve the global namespace problems that C++ inherited from C. The article How To Mangle And Demangle A C++ Method Name explains it well.

The problem I had was that one library had the symbol _ZNK16btCollisionShape17getBoundingSphereER9btVector3Rd and another library referenced _ZNK16btCollisionShape17getBoundingSphereER9btVector3Rf . What was different?

Well, the above referenced article references the “well known” tool of c++filt.

Of course!!

user@ubuntu ~> c++filt _ZNK16btCollisionShape17getBoundingSphereER9btVector3Rd
btCollisionShape::getBoundingSphere(btVector3&, double&) const
user@ubuntu ~> c++filt _ZNK16btCollisionShape17getBoundingSphereER9btVector3Rf
btCollisionShape::getBoundingSphere(btVector3&, float&) const
user@ubuntu ~>

Looks like I am building one library with double precision turned on and the other was referencing it with double precision turned off. Now I know what to fix.

There are just so many tools in Linux.


  1. BulletSim in OpenSimulator