Page 1 of 1

Problem building static iPhone libraries

Posted: Fri Feb 24, 2012 11:17 am
by SadlyNot
This one's an oldy, but everyone seems to be having slightly different problems. I'm trying to build static iPhone libraries from the latest Github revision of chipmunk-physics but the iphone-static.command script in xcode/ fails.

The first error I get is that the iphoneos4.3 SDK doesn't exist, so I changed both SDKs to be version 5.0.

The second error happens in the check dependencies stage when building the iphonesimulator static library (Debug):

[BEROR]No architectures to compile for (ARCHS=armv6 armv7, VALID_ARCHS=i386).

I don't understand how to fix the error, is anyone else experiencing this problem? I'm developing on Mac OSX Lion with Xcode version 4.2.1, Build version 4D502.

I've also tried building from xcode instead of the terminal, but I'm unsure how to switch properly between building Release and Debug libraries for iphoneos and iphonesimulator. I know I could just include the sources in my project and build from there but from what I understand that's not recommended - I'd like to use the static libraries.

Re: Problem building static iPhone libraries

Posted: Sun Feb 26, 2012 3:22 pm
by slembcke
Hmm. So with the 4.3 simulator SDK, it always just figured out that you really wanted to compile for i386. Like it does in Xcode, when you compile for the simulator, it overrides whatever architectures you had set and just sets i386 anyway. I always thought that was a bit weird...

Anyway, the fix is apperently simple enough. The two build lines should look like this to compile against the 5.0 SDK. You already switched the sdk argument, you just need to add the '-arch i386' argument.

Code: Select all

xcodebuild -project Chipmunk6.xcodeproj -sdk iphoneos5.0 -configuration Release -target ChipmunkStatic-iPhone && \
xcodebuild -project Chipmunk6.xcodeproj -sdk iphonesimulator5.0 -arch i386 -configuration Debug -target ChipmunkStatic-iPhone && \

Re: Problem building static iPhone libraries

Posted: Sun Feb 26, 2012 3:42 pm
by SadlyNot
Woohoo! Compiling with no problems :) thanks a lot for your help.

While you're around ... will any of those settings need to change if I am compiling for a different version of the SDK or simulator, say 4.3 or older? Or am I free to simply change the version number now?

Also, if that change is appropriate to push to Github that would be much appreciated.

Re: Problem building static iPhone libraries

Posted: Sun Feb 26, 2012 5:06 pm
by slembcke
Compiling against the 5.0 SDK should be fine even if you want to deploy to iOS 4.x. The issue is that from the command line interface, there is no "Latest SDK" option like there is from within Xcode. I usually bump the SDK number up a few months after an SDK is released. If I do it right away, then only the people that upgraded right away will be able to compile it without editing the script. It's probably time to change it to 5.0 now though.