Error compiling Bullet for iOS arm64 architecture with Xcode

Post Reply
oleksiya
Posts: 1
Joined: Mon Nov 11, 2013 5:13 pm

Error compiling Bullet for iOS arm64 architecture with Xcode

Post by oleksiya »

Hello,

I am able to compile Bullet successfully using either CMake or premake for iOS when enabled armv7 and armv7s architectures. When adding arm64 architecture there is a compiler error(s), the error is related to inline assembly in LinearMath sub-project:

Code: Select all

src/LinearMath/btVector3.cpp:1465:24: error: identifier or immediate expression expected
    float32x4_t vvec = vld1q_f32_aligned_postincrement( vec );
                       ^
src/LinearMath/btVector3.cpp:887:73: note: expanded from macro 'vld1q_f32_aligned_postincrement'
#define vld1q_f32_aligned_postincrement( _ptr ) ({ float32x4_t _r; asm( "vld1.f32  {%0}, [%1, :128]!\n" : "=w" (_r), "+r" (_ptr) ); /*return*/ _r; })
                                                                        ^
<inline asm>:1:23: note: instantiated into assembly here
        vld1.f32  {v0}, [x0, :128]!
Can you suggest how to fix this?

Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Error compiling Bullet for iOS arm64 architecture with X

Post by Erwin Coumans »

It is a recent known issue, see https://code.google.com/p/bullet/issues/detail?id=739

Could you try to disable NEON for 64bit somewhere in btScalar.h, using something like the following line 183 (not tested)

#elif defined( __ARM_NEON__ ) && (!defined(__LP64__) && !defined(_LP64))

If that works for you, please report it in that issue 739
Thanks,
Erwin
iollmann
Posts: 1
Joined: Mon Nov 11, 2013 7:03 pm

Re: Error compiling Bullet for iOS arm64 architecture with X

Post by iollmann »

Change

745: #elif defined (__arm__ )

to

#elif defined (__arm__ ) || defined __arm64__


and fix the broken #define:

#if defined __arm__
# define vld1q_f32_aligned_postincrement( _ptr ) ({ float32x4_t _r; asm( "vld1.f32 {%0}, [%1, :128]!\n" : "=w" (_r), "+r" (_ptr) ); /*return*/ _r; })
#else
# define vld1q_f32_aligned_postincrement( _ptr) ({ float32x4_t _r = ((float32x4_t*)(_ptr))[0]; (_ptr) = (const float*) ((const char*)(_ptr) + 16L); /*return*/ _r; })
#endif
Post Reply