Building OpenSSL on Xcode 4.3 for simulator fails

Alternative names (for search):

  • Xcode script build phase not working
  • Xcode error with "make [1]: cc: No such file or directory"
  • The building for the simulator fails to work with the device
  • Xcode cannot build for i386, but will be for armv6 and armv7

I have an OpenSSL Xcode project that uses the build phase of a script to compile the libcrypto.a and libssl.a static libraries for iOS (it also works for Mac OS X).

The building for the device works without problems, libcrypto.a and libssl.a are created and can be associated with projects.

However, an attempt to create the same libraries for 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 be a slight difference between the settings, the only variable is architecture; armv7 verses i386 .

+4
source share
1 answer

Starting with Xcode 4.3, Apple has stopped linking command-line tools as standard with Xcode.

These problems are caused by Xcode trying to use different compilers for Device (armv6 and armv7) and Simulator (i386).

In the build phase of the script for armv6 and armv7, Xcode will use related tools (in the issue of compiling cc (clang)). But to build a simulator, building phase scripts uses system versions.

If you have not explicitly installed the tools, the assembly will fail.

To install the tools, select Xcode > Preferences > Downloads

Xcode prefs

And click Install for Command Line Tools.

+8
source

Source: https://habr.com/ru/post/1401583/


All Articles