1

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?

kuu
  • 815
  • 1
  • 7
  • 16

2 Answers2

1

Solved this issue by referring other question.

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

Thanks.

Community
  • 1
  • 1
kuu
  • 815
  • 1
  • 7
  • 16
0

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).

Rwhoot
  • 51
  • 4
  • 1
    Thanks for your comment. The library I'm pointing to (libSystem.dylib) is for the iOS simulator and it's a Mach-O universal binary with 2 architectures (i386 + x86_64) according to the file command. – kuu Jan 14 '16 at 08:44