patch for Mingw-w64 and linux builds

simulacrum
Posts: 5
Joined: Sat Nov 27, 2010 2:01 am

patch for Mingw-w64 and linux builds

Post by simulacrum »

mingw-w64 defines long integers with a width of 32 bits which leads to compile errors when casting pointers to an long. The mingw-w64 patch below replaces the cast to long with a cast to uintptr_t when stdint.h is available and ULONG_PTR when on win64. With the patch bullet compiles fine on mingw-w64, vs2008 (win64), vs2008 (win32), and unix makefiles, with demos and extras enabled.

The demos run fine but serialisation wasn't tested and im not sure if it'll work correctly. The main concern being that the bullet DNA comments 'nr' is '(4 bytes) amount of names (int)'. i have no idea what nr is used for and whether or not using uintptr would mess with the bulletDNA. someone with a better understanding of bullet's serializer would need to check it.


Further, bullet 2.77 fails to build on my linux system with the newer gcc 4.4.4 when demos and extras are built. the AppThreadingDemo has unresolved symbols to pthread and OpenCLClothDemo uses snprintf without include <cstdio> (which newer gcc versions require). I've included a separate patch to fix compile errors on linux builds. It just adds pthreads to the link process and includes the cstdio header.


Hopefully the patches work without problems.
cheers,
goran
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: patch for Mingw-w64 and linux builds

Post by Erwin Coumans »

Can you please use svn diff, using the latest Bullet trunk to create the patch?

Thanks a lot,
Erwin
simulacrum
Posts: 5
Joined: Sat Nov 27, 2010 2:01 am

Re: patch for Mingw-w64 and linux builds

Post by simulacrum »

got the patch working with latest dev version. svn diff is below.
havent done full testing but bullet compiles on linux and windows with mingw-w64 just fine.

let me know if something's not right.
thanks,
goran
You do not have the required permissions to view the files attached to this post.
LEgregius
Posts: 26
Joined: Tue Oct 14, 2008 1:34 am

Re: patch for Mingw-w64 and linux builds

Post by LEgregius »

The patch fixes the linux build, but the multi threading doesn't work. The multi-threaded demo won't startup even though all the other demos do, and my applications that use it don't get any collisions when running with the multi threaded using the SpuGatheringCollisionDispatcher.

Anyone seen this? Found a workaround?