Compile OpenSSL for iOS

Source: Internet
Author: User

IOS: 5.1

OS: Lion 10.7.4

1) Compile arm6

Makedir arm6lib

./Configure BSD-generic32 -- prefix =/libs/OpenSSL -- openssldir =/libs/OpenSSL

Change the makefile

Cc =/applications/xcode. APP/contents/developer/platforms/iphoneos. Platform/developer/usr/bin/GCC-arch armv7
Cflag =-dopenssl_threads-pthread-d_thread_safe-d_reentrant-ddso_dlfcn-dhave_dlfcn_h-dtermios-O3-fomit-frame-pointer-wall-isysroot/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/sdks/iphoneos5.1.sdk

Make

Make install

Copy the arm6lib directory

 

Delete the openssl-0.9.8d directory because it is found that make clean does not really clear all, leave a lot of. O files directly in this environment to compile the ARM7 will generate errors

 

2) Compile the ARM7 program.

Compiling in the new environment is similar to that in arm6

Makedir arm7lib

./Configure BSD-generic32 -- prefix =/libs/OpenSSL -- openssldir =/libs/OpenSSL

Change the makefile

Cc =/applications/xcode. APP/contents/developer/platforms/iphoneos. Platform/developer/usr/bin/GCC-arch armv7
Cflag =-dopenssl_threads-pthread-d_thread_safe-d_reentrant-ddso_dlfcn-dhave_dlfcn_h-dtermios-O3-fomit-frame-pointer-wall-isysroot/applications/xcode. APP/contents/developer/platforms/iphoneos. platform/developer/sdks/iphoneos5.1.sdk

Make

Make install

Copy the arm7lib directory

3) connect to the universal lib

We copied arm6lib arm7lib to a directory to go to this directory.

Lipo-create./arm6lib/lib/libcrypto. A./arm7lib/lib/libcrypto. A-output./libcrypto.

Lipo-create./arm6lib/lib/libssl. A./arm7lib/lib/libssl. A-output./libssl.

Inspection result

Lipo-Info libssl.

Result:

Ubuntures In the FAT file: libssl. A are: armv6 armv7

Success

 

4) Simulator Compilation

Similar to the above, it is a little different when you modify makefile.

Cc =/applications/xcode. APP/contents/developer/platforms/iphonesimulator. Platform/developer/usr/bin/GCC-arch i386
Cflag =-dopenssl_threads-pthread-d_thread_safe-d_reentrant-ddso_dlfcn-dhave_dlfcn_h-dtermios-O3-fomit-frame-pointer-wall-isysroot/applications/xcode. APP/contents/developer/platforms/iphonesimulator. platform/developer/sdks/iphonesimulator5.1.sdk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.