Alternate titles (to aid search):
- Xcode Build Phase script fails
- Xcode fail with "make[1]: cc: No such file or directory"
- Building for simulator fails, building for device works
- Xcode fails to build for i386, but will for armv6 & armv7
I have the OpenSSL Xcode project that uses a Build Phase script to compile the libcrypto.a
and libssl.a
static libraries for iOS (it also works for Mac OS X).
Building for device
works with no issues the libcrypto.a
and libssl.a
are created and can be linked into projects.
However, trying to build the same libraries for the simulator
causes a build error:
cc -I. -I.. -I../include -D_DARWIN_C_SOURCE -UOPENSSL_BN_ASM_PART_WORDS -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -c -o cryptlib.o cryptlib.c
make[1]: cc: No such file or directory
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1
There seems to little difference between the settings, the only variable is the architecture; armv7
verses i386
.
Beginning with Xcode 4.3 Apple stopped bundling command line tools as standard with Xcode.
This issues is caused by Xcode trying to use different compilers for Device (armv6 & armv7) and Simulator (i386).
In a build phase script for armv6 & armv7 Xcode will use the bundled tools (in the question the cc
(clang) compile). But for simulator builds, build phase scripts use the system versions.
If you haven't explicitly installed the tools the build will fail.
To install the tools select Xcode > Preferences > Downloads
And click on "Install" for "Command Line Tools".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With