[SOLVED] Linux64 complition error 2.73-rc3

valeranth
Posts: 8
Joined: Fri Nov 14, 2008 9:54 am

[SOLVED] Linux64 complition error 2.73-rc3

Post by valeranth »

Hi,
Not sure if this has been posted before, but a quick look at the main page in a few searches came up nothing. Anyways, When I try and compile bullet from the source I get the following erro
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -g -O2 -g -O2 -MT libbulletmultithreaded_a-SpuCollisionObjectWrapper.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuCollisionObjectWrapper.Tpo -c -o libbulletmultithreaded_a-SpuCollisionObjectWrapper.o `test -f 'BulletMultiThreaded/SpuCollisionObjectWrapper.cpp' || echo './'`BulletMultiThreaded/SpuCollisionObjectWrapper.cpp
BulletMultiThreaded/SpuCollisionObjectWrapper.cpp: In constructor 'SpuCollisionObjectWrapper::SpuCollisionObjectWrapper(const btCollisionObject*)':
BulletMultiThreaded/SpuCollisionObjectWrapper.cpp:27: error: cast from 'const btCollisionObject*' to 'ppu_address_t' loses precision
make[2]: *** [libbulletmultithreaded_a-SpuCollisionObjectWrapper.o] Error 1
This is on a Gentoo/Linux system..
Any ideas?

PS. sorry if this has been posted before
Last edited by valeranth on Sat Nov 15, 2008 12:12 am, edited 1 time in total.
Joczhen
Posts: 17
Joined: Thu Dec 20, 2007 3:17 pm

Re: Linux64 complition error 2.73-rc3

Post by Joczhen »

valeranth wrote:
This is on a Gentoo/Linux system..
Any ideas?
What architecture are you running on? x86_64?

It looks like he's trying to compile 64bit but using 32bit pointers.
src/BulletMultiThreaded/PpuAddressSpace.h defines the following:

#ifdef USE_ADDR64
typedef uint64_t ppu_address_t;
#else
typedef uint32_t ppu_address_t;
#endif

g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -g -O2 -g -O2 -MT libbulletmultithreaded_a-SpuCollisionObjectWrapper.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuCollisionObjectWrapper.Tpo -c -o libbulletmultithreaded_a-SpuCollisionObjectWrapper.o `test -f`
should be more like

Code: Select all

g++ -DHAVE_CONFIG_H -DUSE_ADDR64 -I. -I.. -g -O2 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -g -O2 -g -O2 -MT libbulletmultithreaded_a-SpuCollisionObjectWrapper.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuCollisionObjectWrapper.Tpo -c -o libbulletmultithreaded_a-SpuCollisionObjectWrapper.o `test -f`
But I'm not sure if USE_ADDR64 is set automatically by your compiler environment..
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: Linux64 complition error 2.73-rc3

Post by John McCutchan »

Hi,

Are you using the autoconf/automake build environment?

Thanks,
John
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: Linux64 complition error 2.73-rc3

Post by John McCutchan »

Hi valeranth,

I've committed two change this morning that should help you. The first is to enable the USE_ADDR64 define on X86-64 builds. The second is the command line argument to configure "--disable-multithreaded" which will disable building the multithreaded portions of Bullet.

Please let me know if this does or doesn't solve your problems.

Thanks,
John
valeranth
Posts: 8
Joined: Fri Nov 14, 2008 9:54 am

Re: Linux64 complition error 2.73-rc3

Post by valeranth »

Using the lastest SVN, I got the following error
g++ -DHAVE_CONFIG_H -I. -I.. -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -MT libbulletmultithreaded_a-SpuContactResult.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuContactResult.Tpo -c -o libbulletmultithreaded_a-SpuContactResult.o `test -f 'BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp' || echo './'`BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp: In member function 'void SpuContactResult::writeDoubleBufferedManifold(btPersistentManifold*, btPersistentManifold*)':
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp:167: error: cast from 'btPersistentManifold*' to 'uint32_t' loses precision
In the mean time I've successfully compiled it with --disable-multithreaded.

As for the question before, yes I am using x86_64, here is my uname if this will help anything (atleast it proves im using x86_64 :P)
Linux localhost 2.6.27-gentoo-r2 #1 SMP PREEMPT Tue Nov 4 17:51:32 CST 2008 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux

I also did the standard autogen, configure, make method of compiling. I never tried jam but don't see how that would change anything.
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: Linux64 complition error 2.73-rc3

Post by John McCutchan »

Thanks,

From what you've pasted, both of my changes did work as intended. The compile error is because the code is explicitly casting a pointer to a uint32_t.

Could you change line 167 to look like:

ppu_address_t mmAddr = (ppu_address_t)mmManifold;

Does that work?

Thanks,
John
valeranth
Posts: 8
Joined: Fri Nov 14, 2008 9:54 am

Re: Linux64 complition error 2.73-rc3

Post by valeranth »

John McCutchan wrote:Thanks,

From what you've pasted, both of my changes did work as intended. The compile error is because the code is explicitly casting a pointer to a uint32_t.

Could you change line 167 to look like:

ppu_address_t mmAddr = (ppu_address_t)mmManifold;

Does that work?

Thanks,
John
changed the line and got
g++ -DHAVE_CONFIG_H -I. -I.. -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -MT libbulletmultithreaded_a-SpuGatheringCollisionTask.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuGatheringCollisionTask.Tpo -c -o libbulletmultithreaded_a-SpuGatheringCollisionTask.o `test -f 'BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp' || echo './'`BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp: In function 'void processCollisionTask(void*, void*)':
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp:905: error: cast from 'void*' to 'int' loses precision
tryed reinterpret_case<int> didnt fix it =/ (dont use pointer conversion much, but ill post if I find a way to fix it)
valeranth
Posts: 8
Joined: Fri Nov 14, 2008 9:54 am

Re: Linux64 complition error 2.73-rc3

Post by valeranth »

changing that line to

Code: Select all

userInfo = int((ppu_address_t)&pair.m_userInfo );
fixes that and produces this
g++ -DHAVE_CONFIG_H -I. -I.. -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -MT libbulletmultithreaded_a-SpuParallelSolver.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuParallelSolver.Tpo -c -o libbulletmultithreaded_a-SpuParallelSolver.o `test -f 'BulletMultiThreaded/SpuParallelSolver.cpp' || echo './'`BulletMultiThreaded/SpuParallelSolver.cpp
BulletMultiThreaded/SpuParallelSolver.cpp: In member function 'void SolverTaskScheduler::issueTask()':
BulletMultiThreaded/SpuParallelSolver.cpp:581: error: cast from 'SpuSolverTaskDesc*' to 'uint32_t' loses precision
changing that to 'm_threadInterface->sendRequest(1, (ppu_address_t)&desc, m_currentTask);' solves it and produces
g++ -DHAVE_CONFIG_H -I. -I.. -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -I./BulletMultiThreaded/vectormath/scalar/cpp -DUSE_ADDR64 -g -O2 -DUSE_ADDR64 -g -O2 -MT libbulletmultithreaded_a-SpuRaycastTaskProcess.o -MD -MP -MF .deps/libbulletmultithreaded_a-SpuRaycastTaskProcess.Tpo -c -o libbulletmultithreaded_a-SpuRaycastTaskProcess.o `test -f 'BulletMultiThreaded/SpuRaycastTaskProcess.cpp' || echo './'`BulletMultiThreaded/SpuRaycastTaskProcess.cpp
BulletMultiThreaded/SpuRaycastTaskProcess.cpp: In member function 'void SpuRaycastTaskProcess::issueTask2()':
BulletMultiThreaded/SpuRaycastTaskProcess.cpp:82: error: cast from 'SpuRaycastTaskDesc*' to 'uint32_t' loses precision
chaning that to 'm_threadInterface->sendRequest(1, (ppu_address_t) &taskDesc,m_currentTask)' solves it
BulletMultiThreaded/SpuCollisionTaskProcess.cpp:131: error: cast from 'SpuGatherAndProcessPairsTaskDesc*' to 'uint32_t' loses precision
same change..
BulletMultiThreaded/SpuSampleTaskProcess.cpp:133: error: cast from 'SpuSampleTaskDesc*' to 'uint32_t' loses precision
AND COMPILED!!! ^_^

I can make a patch file for these if you want, just need to be walked threw how to make the patch
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: Linux64 complition error 2.73-rc3

Post by John McCutchan »

Hey valeranth,

Can you test out the latest SVN. Please make sure you run configure with --enable-multithreaded

Thanks,
John
valeranth
Posts: 8
Joined: Fri Nov 14, 2008 9:54 am

Re: Linux64 complition error 2.73-rc3

Post by valeranth »

checking out now, ill edit this post when it gets done compiling :P

COmpiled fix, thanks ^_^