bFile ODR violations
I would like to make it easier to consume bullet.
The overlapping symbols of bFile in bFile.cpp and b3File.cpp can cause link errors when linking with some targets and in specific orders. For example, linking Bullet2FileLoader followed by BulletFileLoader causes duplicate symbol errors as bFile.cpp is pulled in by the linker for the missing definitions in b3File.cpp.
ld64.lld: error: duplicate symbol: bParse::bFile::parseStruct(char*
>>> defined in /Users/userhome/development/explore/conan/p/b/bulleeccf1560f1b54/b/src/src/B
ullet3Serialize/Bullet2FileLoader/b3File.cpp
>>> /Users/userhome/development/explore/conan/p/b/bulleeccf1560f1b54/p/lib/libBu
llet2FileLoader.a(b3File.cpp.o)
>>> defined in /Users/userhome/development/explore/conan/p/b/bulleeccf1560f1b54/p/lib/libBu
lletFileLoader.a(bFile.cpp.o)When linking BulletFileLoader followed by Bullet2FileLoader, the BulletFileLoader implementation is linked without raising an error.
I like the convenience of linking a single cmake target e.g. Bullet::Bullet, that package managers like conan provide. In my case I need btBulletWorldImporter, the only thing that deserializes optimizedBvh from binary AFAIK, which still depends on BulletFileLoader, so I have to surgically remove Bullet2FileLoader from my linked targets to avoid the ODR violation.
Is it important that there are two definitions of the bFile class i.e. that they have the same name?
I am also very confused by the many serializers and loaders which seem to me like they should all achieve the same task, but their existence tells me that they don't. So maybe I am just missing some crucial documentation for this feature.
Source: bulletphysics/bullet3