`
yangwei0915
  • 浏览: 465817 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

[转] How To Compile OpenSSL for the iPhone

阅读更多

This is a quick tutorial to show you how to minimally compile a version of the openssl and crypto libraries for the iPhone/iPad.

Download and Configure OpenSSL

First thing to do is grab the openssl source.  You can get that here.  I’ll be using openssl-1.0.0 for this demo.  Unzip this file (mines on the desktop).  Open up a terminal and go to the unzipped folder and run the default configuration.  The argument passed is where your ‘make install’ will place the compiled libraries. You should replace this with your path.

cd Desktop/openssl-1.0.0
./config --openssldir=/Users/airpard/Desktop/openssl_ios/ no-asm

* Note if you want a simulator build you should do a regular make; make install at this point. The following steps are for armv6 and armv7 using the latest v4.2 iOS environment.

Edit the Makefile

Next thing to do is open up the make file.  This is named “Makefile” in the current directory you should already be in with the terminal.  Here are the list of changes to make (for armv7, replace armv6 references below):

Find CC= cc and change it to:
CC= /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
 
Find -arch i386 in CFLAG and change it to:
-arch armv6
 
Find CFLAG and add to the BEGINNING!!:
-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk
 
Find SHARED_LDFLAGS=-arch i386 -dynamiclib and change it to:
SHARED_LDFLAGS=-arch armv6 -dynamiclib
 
Find PEX_LIBS= -Wl, -search_paths_firstxc and change it to:
PEX_LIBS= -Wl

Fix Build Error

If you build it at this point you may have noticed a build error. To fix this open up ui_openssl.c. This is located in openssl-1.0.0/crypto/ui/ folder. If you have a text editor with line numbers, head down to line 407. Otherwise do a text search to make this change:

static volatile sig_atomic_t intr_signal;
to
static volatile int intr_signal;

Save your changes and you should now be able to build with no errors.

Build Libraries

make
make install

That’s it. You’ll notice that everything was moved to the path provided in step 1 when configuring openssl. Remember to add the include folder to your Xcode project. Also, remember these libraries are only built for the iPhone and will not work in the simulator. You can change all the armv6 references to i386 and build it again if you choose to. Happy Coding!

 

找到build_all: build_libs build_apps build_tests build_tools(大概在242行)
修改为build_all: build_libs build_apps build_tools

分享到:
评论

相关推荐

    vbe 3.0 samples ,how to compile it? (1)

    how to compile the sample ?

    How to compile Windows Server 2003-bO0daYbti5g.mkv

    How to compile Windows Server 2003-bO0daYbti5g.mkv windows server 2003操作系统源代码构建指南视频教程

    openssl1.1.1i-compile.tar.gz

    1、直接将编译好的包openssl1.1.1i-compile.tar上传包至/opt 2、解压 tar -zxvf openssl1.1.1i-compile.tar.gz 3、将解压出来的openssl移动到/usr/local下 mv openssl /usr/local/ 4、备份原来的,设置软链(参考我...

    How to compile SQLCipher on Windows.rar

    在“配置属性”下,转到“C/C++” -> “预处理器”,添加`SQLITE_HAS_CODEC`和`SQLITE_TEMP_STORE=2`预处理器定义。 5. **设置库依赖**:SQLCipher依赖于OpenSSL进行加密。你需要下载并编译OpenSSL库,然后在Visual...

    How to build compile server with virtualbox & samba

    How to build compile server with virtualbox & samba

    How to compile SQLCipher on Windows.mp4

    (跑通sqlcipher-4.4.0)https://www.youtube.com/watch?v=SFHGeetZ0po

    compile DCMTK for Windows with CMake

    OpenSSL support: set "DCMTK_WITH_OPENSSL" to "ON" and "WITH_OPENSSLINC" as well as "WITH_OPENSSLLIB" to the respective paths for OpenSSL include files and libraries. TIFF support: set "DCMTK_WITH_...

    Win64OpenSSL_Light-1_1_0k.exe

    OpenSSL Installation Project is dedicated to providing a simple installation of OpenSSL for Microsoft Windows. It is easy to set up and easy to use through the simple, effective installer. No need to ...

    compile-openssl-android.sh

    openssl android ndk编译脚本,可通过修改配置单独编译输出arm32 arm64的库

    How+to+Use+Ceedling+for+Embedded+Test-Driven+Development.pdf

    We'll look at how to use the unit test framework called Ceedling to help us do this. In the first example, we'll see how to create tests and write the code to make them pass. In the second example we ...

    Programming for Mathematicians by Raymond Seroul

    The last chapter explains how a compiler works and shows how to compile "by hand" little (but not trivial--even recursive) programs. The book is intended for anyone who thinks mathematically and ...

    Java_for_the_Web_with_Servlets

    - **JSP Directives**: Directives provide instructions to the JSP engine about how to compile the page. Common directives include `page`, `include`, and `taglib`. - **JSP Actions**: JSP actions are ...

    python leveldb for windows预编译(含DLL和Pyd文件)

    由于python leveldb在windows上使用需要复杂的编译过程,故提供可以直接用的pyd文件leveldb.pyd,可以直接放在site-package目录下然后import leveldb; 如果需要dll文件,也有相应提供leveldb.dll和编译中间文件,...

    iOS openssl加密解密DEMO

    "OpenSSL-for-iPhone-master"这个压缩包中可能包含了预编译的库文件,或者源码,如果是源码,你需要按照以下步骤进行编译: 1. 解压下载的压缩包,进入"OpenSSL-for-iPhone-master"目录。 2. 使用Xcode或命令行工具...

    Android代码-LLollipop dialog demo

    Android L Dialog A library to be used for creating android-l like dialogs on android 2.3 ...How to compile the example Download the zip Extract Import with android studio or intellij Run How to

    moc.exe 解决moc过程中不支持处理enum包含#include头文件的语法。

    The moc process failed to compile "SRC:/..............." into "Src:/................................." command -------- path/to/path 问题2 tbb/tbb_profiling.:28: Parse error at "{

    a project model for the FreeBSD Project.7z

    I would like to thank the following people for taking the time to explain things that were unclear to me and for proofreading the document. Andrey A. Chernov Bruce A. Mah Dag-Erling Smørgrav ...

    Cross compile OpenSSH for mips

    ### Cross Compile OpenSSH for MIPS 在嵌入式系统的开发过程中,常常需要为特定的硬件平台构建定制化的软件组件。本文将详细介绍如何为MIPS架构的嵌入式设备交叉编译OpenSSH,以便能够在其上运行SFTP服务。由于...

    Packt.Julia.High.Performance.2nd.Edition.rar

    Moving ahead, you'll master design constraints and learn how to use the power of the GPU in your Julia code and compile Julia code directly to the GPU. Then, you'll learn how tasks and asynchronous ...

    Java邮件开发Fundamentals of the JavaMail API

    Instructions on how to download and install the JavaMail API are contained in the course. In addition, you will need a development environment such as the JDK 1.1.6+ or the Java 2 Platform, Standard...

Global site tag (gtag.js) - Google Analytics