4

This question is related, but does not resolve the specific issue I am having.

I am using Xcode 4.6.3 under OS X 10.7.5.

I simply created the default project for a single view iOS app and made no changes to the project settings. The project, of course, builds in Xcode for the iOS Simulator. However, when I try to use xcodebuild from the command line, xcodebuild fails.

The project name is just: temp

I tried:

xcodebuild -scheme temp -sdk iphonesimulator6.1

and that produced the results:

Build settings from command line:
    SDKROOT = iphonesimulator6.1

=== BUILD NATIVE TARGET temp OF PROJECT temp WITH CONFIGURATION Debug ===
Check dependencies
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).


** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)

Based on the other SO question, I tried:

xcodebuild ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -scheme temp -sdk iphonesimulator6.1

and got similar results:

Build settings from command line:
    ARCHS = armv7 armv7s
    ONLY_ACTIVE_ARCH = NO
    SDKROOT = iphonesimulator6.1

=== BUILD NATIVE TARGET temp OF PROJECT temp WITH CONFIGURATION Debug ===
Check dependencies
No architectures to compile for (ARCHS=armv7 armv7s, VALID_ARCHS=i386).


** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)

What xcodebuild command do I need to execute to be able to build with xcodebuild?

Thank you.

Community
  • 1
  • 1
ericg
  • 8,413
  • 9
  • 43
  • 77

1 Answers1

1

UPDATED: Seems like many folks have trouble of this sort in xcode 4, and the general solution seems to be to force the architecture you need and disable 'active only', which is what you had tried to do... but for the simulator, you need to specify i386 instead of arm*, like this:

xcodebuild ARCHS="i386" ONLY_ACTIVE_ARCH=NO -scheme temp -sdk iphonesimulator6.1

* ORIGINAL response which spawned comment thread below and still has some valuable reference: It sounds like your project my not be set up for 64-bit. You should be able to add arm64 to your valid architectures in your build settings and I believe xcode will automatically treat it as x86_64 for simulator builds.

For the second thing you attempted, you are hard-coding your architectures to IPhone architectures while targeting a simulator, which I believe is why the architectures are not available there.

J. Paulding
  • 494
  • 3
  • 9
  • 1
    The Xcode app can build it without any problems for the simulator. Only when I try to use xcodebuild from the command line does it fail. If the Xcode app can build it, xcodebuild should be able to. I only need to know what parameters to pass to xcodebuild. – ericg Dec 10 '13 at 21:14
  • 1
    Hmm - well, from the initial problem you had it appears to be trying to build a 64-bit target for a project that isn't set up for that. Perhaps try using -arch i386 to force a valid architecture? – J. Paulding Dec 10 '13 at 21:28
  • Yes, I had tried that as well, it still fails with similar results. With Xcode 5 this all seems a lot more stable, but I need it to work with Xcode 4.6.3. – ericg Dec 11 '13 at 14:55
  • What is the exact error you get when using: xcodebuild ARCHS="i386" ONLY_ACTIVE_ARCH=NO -scheme temp -sdk iphonesimulator6.1 – J. Paulding Dec 11 '13 at 15:05
  • Ya...I left off ONLY_ACTIVE_ARCH=NO. If you want to update your answer with this information, I will mark it as answered. – ericg Dec 11 '13 at 19:31