kuu
kuu

Reputation: 865

Unable to build OpenSSL for iOS Simulator

I'm trying to build OpenSSL for iOS Simulator with the following steps: (MackBook Pro, OS X Version 10.10.5v + Xcode Version 7.2)

$ mkdir openssl
$ cd openssl
$ wget http://www.openssl.org/source/openssl-1.0.2e.tar.gz
$ tar xvzf openssl-1.0.2e.tar.gz
$ cd openssl-1.0.2e
$ mkdir /tmp/openssl-1.0.2e-i386
$ ./configure BSD-generic32 --openssldir=/tmp/openssl-1.0.2e-i386
$ vi Makefile
  Make the following changes:
  1) Replace
      "CC= gcc"
       with
      "CC= /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386"
  2) Append
      "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
      to the end of
      "CFLAG= ..."
$ make

However, the following error occurs:

ld: building for OSX, but linking against dylib built for iOS, file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.dylib' for architecture i386

Can someone tell me what is wrong?

Upvotes: 1

Views: 1076

Answers (2)

kuu
kuu

Reputation: 865

Solved this issue by referring other question.

I added "-miphoneos-version-min=6.0" to CFLAG and the issue has gone.

Thanks.

Upvotes: 1

Rwhoot
Rwhoot

Reputation: 61

The error is one that you receive whenever you're importing and trying to link an OSX app to an iOS system library. There are many differences between the two platforms, and the libraries are not interchangeable. You're running a line to change the location of the library file that is pulled for the project. Ensure that the library you're pointing to has slices for the system architecture you're trying to build for (i386, in this case).

Upvotes: 0

Related Questions