Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If VALID_ARCHS set to armv7 armv7a, then how does xcode build for simulator?

I am trying to solve a cryptic puzzle that I really appreciate the explanation for as this will help me understand the tools and be confident about what i do.

I came across the puzzle when cranking up xcodebuild commandline to build my iPhone app. I found it to reject '-sdk iphonesimulator6.0" with this message: "No architectures to compile for (ARCHS=i386, VALID_ARCHS=armv7)."

I then saw my VALID_ARCHS were set to armv7 and that appeared to explain why xcodebuild refused to build for simulator (which i led myself to believe was intel). But how on earth does my XCode IDE go around it and manages to build for simulator (which it does)?

Changing VALID_ARCHS to: VALID_ARCHS = "$(ARCHS_STANDARD_32_BIT)";(which expands to armv7 and armv7a) or VALID_ARCHS = armv7 i386 Seemed to have satisfied xcodebuild enough to agree to build for simulator. Mind you, the first case still doesn't list i386! And I must conclude i386 becomes, in certain conditions, implicit. Can anyone confirm and/or expand on any of this?

like image 563
Remster Avatar asked Nov 12 '22 12:11

Remster


1 Answers

When xcode build on i386 it changes these variables, you can witness this in xcode Log navigator...

These are the Variables xcode manipulate in order to allow running on i386

VALID_ARCHS=i386 ARCHS=i386

You can do the same by invoking xcodebuild command in the following manner:

xcrun xcodebuild VALID_ARCHS=i386 ARCHS=i386 ONLY_ACTIVE_ARCH=NO -arch i386 -sdk iphonesimulator7.1 -configuration Debug
like image 143
ekeren Avatar answered Nov 15 '22 09:11

ekeren