Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build against bullet double precision library #191

Open
rapsys opened this issue Dec 9, 2022 · 5 comments
Open

Unable to build against bullet double precision library #191

rapsys opened this issue Dec 9, 2022 · 5 comments

Comments

@rapsys
Copy link

rapsys commented Dec 9, 2022

Hi,

This follow up my trouble to get vdrift and stuntrally to build with a double precision bullet library.

Here is the patch that fixes it:
https://svnweb.mageia.org/packages/cauldron/vdrift/current/SOURCES/vdrift-2014-10-20-bullet-double.patch?revision=1919674&view=markup

Best regards

@gaoDean
Copy link

gaoDean commented Dec 11, 2022

Hello there, I am not a maintainer or anything, but I just wanted to ask you if there were any noticeable benefits to using double precision bullet, (like when playing) as well as how to build with double precision?

@rapsys
Copy link
Author

rapsys commented Dec 11, 2022

The main reason was that openmw require bullet library with double precision, there was collision issue that they fixed that way.
I just patched stuntrally, vdrift and irrlamb to only need on single common library.

I think you will learn more with the openmw pull request:
OpenMW/openmw#2049

@gaoDean
Copy link

gaoDean commented Dec 12, 2022

Hello again, thanks for the information, but when I try to build (with your changes) it gives me this error (with bullet from homebrew and -DBT_USE_DOUBLE_PRECISION in my SConstruct):

src/dynamicsdraw.cpp:47:20: error: non-constant-expression cannot be narrowed from type 'btScalar' (aka 'double') to 'float' in initializer list [-Wc++11-narrowing]
        float verts[6] = {from.x(), from.y(), from.z(), to.x(), to.y(), to.z()};
                          ^~~~~~~~
src/dynamicsdraw.cpp:47:20: note: insert an explicit cast to silence this issue
        float verts[6] = {from.x(), from.y(), from.z(), to.x(), to.y(), to.z()};
                          ^~~~~~~~
                          static_cast<float>( )

Am I supposed to have this error, or am I using a wrong version of bullet or smth.

Thanks again

@gaoDean
Copy link

gaoDean commented Dec 12, 2022

Also, when I do the casts and it compiles, it gives these linker errors:

Undefined symbols for architecture x86_64:
  "btRigidBody::setMassProps(double, btVector3 const&)", referenced from:
      FractureBody::FractureBody(FractureBodyInfo const&) in fracturebody.o
  "btRigidBody::predictIntegratedTransform(double, btTransform&)", referenced from:
      CarDynamics::updateAction(btCollisionWorld*, double) in cardynamics.o
  "btCapsuleShape::btCapsuleShape(double, double)", referenced from:
      LoadCapsuleShape(PTree const&, btTransform const&, btCollisionShape*&, btCompoundShape*&) in loadcollisionshape.o
  "btCapsuleShapeX::btCapsuleShapeX(double, double)", referenced from:
      LoadCapsuleShape(PTree const&, btTransform const&, btCollisionShape*&, btCompoundShape*&) in loadcollisionshape.o
  "btCapsuleShapeZ::btCapsuleShapeZ(double, double)", referenced from:
      LoadCapsuleShape(PTree const&, btTransform const&, btCollisionShape*&, btCompoundShape*&) in loadcollisionshape.o
  "btConvexHullShape::btConvexHullShape(double const*, int, int)", referenced from:
      LoadHullShape(PTree const&, btTransform const&, btCollisionShape*&, btCompoundShape*&) in loadcollisionshape.o
  "btMultiSphereShape::btMultiSphereShape(btVector3 const*, double const*, int)", referenced from:
      LoadHullShape(PTree const&, btTransform const&, btCollisionShape*&, btCompoundShape*&) in loadcollisionshape.o
  "btStaticPlaneShape::btStaticPlaneShape(btVector3 const&, double)", referenced from:
      PerformanceTesting::Test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, ContentManager&, std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in performance_testing.o
  "btDiscreteDynamicsWorld::updateActions(double)", referenced from:
      btDiscreteDynamicsWorld::updateVehicles(double) in dynamicsworld.o
  "btDiscreteDynamicsWorld::stepSimulation(double, int, double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
  "btDiscreteDynamicsWorld::saveKinematicState(double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
  "btDiscreteDynamicsWorld::integrateTransforms(double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
  "btDiscreteDynamicsWorld::updateActivationState(double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
  "btDiscreteDynamicsWorld::createPredictiveContacts(double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
  "btDiscreteDynamicsWorld::predictUnconstraintMotion(double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
  "btDiscreteDynamicsWorld::internalSingleStepSimulation(double)", referenced from:
      vtable for DynamicsWorld in dynamicsworld.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [build/vdrift.app/Contents/MacOS/vdrift] Error 1
scons: building terminated because of errors.
make: *** [ALL] Error 2

commit here

@rapsys
Copy link
Author

rapsys commented Dec 13, 2022

When I say logs, I mean FULL LOGS, even the last failing build commands :)

From what I see you builded against a double precision bullet, but at linking step you seems to miss a -lBulletWorldImporter or somthing in the linking command.

You may require this patch and rebuild your bullet library with it to have the library exported in the cmake config file:
https://svnweb.mageia.org/packages/cauldron/bullet/current/SOURCES/bullet-3.24-fix-bullet-config.cmake.patch?revision=1919697&view=markup

It's strange, seeing the log I required this patch only for stuntrally, not for vdrift...

Or did I do vdrift after stuntrally and didn't encounter the problem, dunno ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants