Dwight Kelly
Dwight Kelly

Reputation: 1238

Why getting differences between using XCode and xcodebuild?

Can anyone explain why I get different results when compiling the same XCode 4.x project using the GUI and xcodebuild command-line?

XCode GUI

  1. Perform a clean
  2. Build "Release" target
  3. Build successfully

xcodebuild

  1. Perform a clean
  2. Run "xcodebuild -configuration Release"
  3. Results in the following errors:

    /Developer/usr/bin/gcc-4.0 -x objective-c -arch i386 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fvisibility=hidden -mmacosx-version-min=10.4 -c "/Users/XXX/Extensions/NSFileManager_Extensions.m" -o "/Users/XXX/Developer/Intermediates/YourApp.build/Release/YourApp.build/Objects-normal/ppc/NSFileManager_Extensions.o" /Users/XXX/Extensions/NSFileManager_Extensions.m:15:60: error: ToxicRegularExpressions/ToxicRegularExpressions.h: No such file or directory ** BUILD FAILED **

The following build commands failed: CompileC "/Users/XXX/Developer/Intermediates/YourApp.build/Release/YourApp.build/Objects-normal/ppc/NSFileManager_Extensions.o" /Users/XXX/Extensions/NSFileManager_Extensions.m normal ppc objective-c com.apple.compilers.gcc.4_0

And finally GUI + xcodebuild

  1. Perform a clean in GUI
  2. Build "Release" target
  3. Builds successfully
  4. Run "xcodebuild -configuration Release"
  5. Builds successfully

Upvotes: 7

Views: 3530

Answers (3)

user3093235
user3093235

Reputation: 397

Specify the scheme you want to build with -scheme. Without it xcodebuild may use the "legacy" target driven build system, which is different. You may want to make some of your schemes shared for this, when redistributing projects.

See: Postscriptum of xcodebuild driving me nuts again with a zombie OBJROOT

Upvotes: 1

Ben Mordue
Ben Mordue

Reputation: 477

Do you have more than one version of XCode installed? If so, this answer to a related question might solve your problem: https://stackoverflow.com/a/11129067/567039

Upvotes: 0

Michael Fey
Michael Fey

Reputation: 1239

Try passing the SDK on the command line, like so:

xcodebuild -configuration Release -sdk iphonesimulator3.0

Upvotes: 2

Related Questions