Building 2.81 for iOS - having issues.

Post Reply
alh
Posts: 3
Joined: Tue Dec 04, 2012 11:21 am

Building 2.81 for iOS - having issues.

Post by alh »

Hi!

I ran into some troubles when I tried building Bullet for iOS.

What I did was to add all the sources from BulletCollision, BulletDynamics, vectormath and LinearMath to my iOS project (for easy debugging and patching)

My first issue was an invalid preprocessor instruction in btScalar.h, there was a line called "#end", but there seems to be no #end instruction in the preprocessor.
After trying to decrypt the header file, I concluded this #end could just be removed, and after doing this everything compiled fine.
Is this correct or am I misunderstanding something?
Is it a typo or is #end supposed to do something?

My second issue was when trying to enable NEON.
the __armv7__ macro was not defined, so no NEON code was enabled at first.
I added "|| defined(__ARM_ARCH_7S__)" and then NEON code is enabled.

But it does not compile.
I get several "Constant expression evaluates to 4294967295 which cannot be narrowed to type 'int32_t' (aka 'int')" and "Constant expression evaluates to -1 which cannot be narrowed to type 'int32_t' (aka 'int')".
Here is an example of a line that fails with the first message (L68, btVector3.h):
"const int32x4_t ATTRIBUTE_ALIGNED16(btvFFF0Mask) = (int32x4_t){0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0};"

XCode suggests to fix it with an explicit typecast, but I feel unsure if this is the right approach.

Anyone who can advice?
Am I just messing things up, not using the cmake system, or is the iOS build slightly broken in 2.81?
btScalar.h looks quite messy in the iOS definitions, with a couple of redundant #ifdefs
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Building 2.81 for iOS - having issues.

Post by Erwin Coumans »

The #end issue in btScalar.h is fixed in latest trunk.

You shouldn't need to adjust other compiler directives. If __armv7__ seems required for our NEON implementation, so your compiler/version might not match.
What iOS version, XCode version and compiler flavor and version are you using?
(gcc, llvm-gcc, llvm, iOS 5, 6?, XCode?)
alh
Posts: 3
Joined: Tue Dec 04, 2012 11:21 am

Re: Building 2.81 for iOS - having issues.

Post by alh »

I'm using XCode 4.5.2 with SDK 6.0 (but target is 5.0), and I'm using Apple LLVM 4.1, with language dialect GNU++11, and GNU C++ standard library.
Architecture is armv7 and armv7s (ARCHS_STANDARD_32_BIT)

I probably could change some of the settings, for which configuration is Bullet tested?

Thanks!
nadro
Posts: 17
Joined: Tue Jul 03, 2007 10:37 am

Re: Building 2.81 for iOS - having issues.

Post by nadro »

It looks like eg. "_ARM_ARCH_7" is better way do detect ARM v7 architecture. "__armv7__" is missing in the latest XCode versions, so NEON is disabled by default.
alh
Posts: 3
Joined: Tue Dec 04, 2012 11:21 am

Re: Building 2.81 for iOS - having issues.

Post by alh »

Another note for future readers: You also need to set the language dialect to GNU++98, or the NEON code will not compile
sth
Posts: 1
Joined: Sun Mar 17, 2013 7:15 pm

Re: Building 2.81 for iOS - having issues.

Post by sth »

It's possible to check for NEON support directly using __ARM_NEON__:

Code: Select all

            ...
        #endif //BT_USE_SSE
    #elif defined( __ARM_NEON__ )
        #ifdef __clang__
            ...
Post Reply