logo

English

이곳의 프로그래밍관련 정보와 소스는 마음대로 활용하셔도 좋습니다. 다만 쓰시기 전에 통보 정도는 해주시는 것이 예의 일것 같습니다. 질문이나 오류 수정은 siseong@gmail.com 으로 주세요. 감사합니다.

iOS - Openssl 빌드하기

by digipine posted Nov 01, 2017
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

1. openssl 다운로드

http://www.openssl.org 에서 다운로드
(2011.1.12 현재 openssl-1.0.0c  버전이 최신버전)
사용자의 위치에 압축풀기
ex) /Users/사용자이름/AppDev/openssl-1.0.0c
 
인스톨 위치 결정
ex)
cd /Users/사용자이름/AppDev/
mkdir openssl
cd openssl
mkdir openssl_i386 openssl_armv6 openssl_armv7
 
2. 소스코드 수정
Filename : openssl-1.0.0c/crypto/ui/ui_openssl.c 
수정할 부분 : static volatile sig_atomic_t intr_signal;
수정후 내용 : static volatile int intr_signal;
 
tip. 소스의 수정은 vi 에디터 등으로 할 수 있다. ":"를 눌러 커맨드 모드에서 
"/static volatile " 와 같이 치면 해당 부분을 바로 찾아준다.
 
3. makefile 수정
1) build 디렉토리를 다음과 같이 만든다.
mkdir openssl_temp
 
2) Config 파일을 구성한다.
./Configure BSD-generic32 enable-seed --openssldir=/Users/사용자명/AppDev/openssl-1.0.0c/openssl_temp
 
 
4. i386 (시뮬레이터)용 openssl 빌드
1) Makefile 을 수정한다.
수정전 내용 : CC = gcc
수정후 내용 : CC= /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
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk
 
2) build 수행
make
make install
 
3) Build 확인
ls -l openssl_test/lib
drwxr-xr-x  2 사용자명  staff       68  1 12 16:05 engines
-rw-r--r--  1 사용자명  staff  2584744  1 12 16:05 libcrypto.a
-rw-r--r--  1 사용자명  staff   454896  1 12 16:05 libssl.a
drwxr-xr-x  5 사용자명  staff      170  1 12 16:05 pkgconfig
 
4) Build 버전 이동
mv openssl_temp/ ../openssl/openssl_i386
 
 
5. arm6 (아이폰/아이패드)용 openssl 빌드
1) Makefile 을 수정한다.
수정전 내용 : CC= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386
수정후 내용 : CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6
 
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
 
2) build 수행
make clean
make
make install
 
3) Build 확인
ls -l openssl_temp/lib
drwxr-xr-x  2 사용자명  staff       68  1 12 16:20 engines
-rw-r--r--  1 사용자명  staff  2999344  1 12 16:20 libcrypto.a
-rw-r--r--  1 사용자명  staff   497936  1 12 16:20 libssl.a
drwxr-xr-x  5 사용자명  staff      170  1 12 16:20 pkgconfig
 
4) Build 버전 이동
mv openssl_temp/ ../openssl/openssl-armv6
 
 
 
6. arm7 (아이폰/아이패드)용 openssl 빌드
1) Makefile 을 수정한다.
수정전 내용 : CC= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386
수정후 내용 : CC = /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 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
 
2) build 수행
make clean
make
make install
 
3) Build 확인
ls -l openssl_temp/lib
drwxr-xr-x  2 사용자명  staff       68  1 12 16:35 engines
-rw-r--r--  1 사용자명  staff  2666440  1 12 16:35 libcrypto.a
-rw-r--r--  1 사용자명  staff   425368  1 12 16:35 libssl.a
drwxr-xr-x  5 사용자명  staff      170  1 12 16:35 pkgconfig
 
4) Build 버전 이동
mv openssl_temp/ ../openssl/openssl-armv7
 
7. Univerals (통합버전) 만들기
1) include 파일 복사
cd /Users/사용자명/AppDev/openssl-1.0.0c
cp -RL include ../openssl/include
 
tip. -R 옵션은 디렉토리 복사이고, -L 옵션은 심볼릭링크 파일인 경우, 원본을 찾아서 이를 복사하는 옵션이다. 해당 include의 파일들을 보면 알겠지만, 모두 심볼릭 링크 파일로 되어있다.
 
2) lib 파일 통합
cd /Users/사용자명/AppDev/openssl 
lipo -create openssl_i386/lib/libssl.a openssl_armv6/lib/libssl.a openssl_armv7/lib/libssl.a -output libssl.a
lipo -create openssl_i386/lib/libcrypto.a openssl_armv6/lib/libcrypto.a openssl_armv7/lib/libcrypto.a -output libcrypto.a
 
tip. 이후 배포할때 include 디렉토리와 libssl.a 및 libcrypto.a 파일을 함께 배포하면 된다.
 
TAG •

List of Articles
No. Subject Author Date Views
55 macOS Daemon 관련 시스템 폴더 목록 lizard2019 2024.03.08 10
54 [macOS, iOS] 개발자 정보 확인하는 명령어 digipine 2023.03.23 150
53 Firebase 'GoogleUtilities/GULURLSessionDataResponse.h' file not found Error Fix lizard2019 2023.07.04 184
52 iOS - Socket Nagle 알고리듬 OFF digipine 2017.11.01 208
51 iOS - Thread Loop 내에서 UI 업데이트 방법 digipine 2017.11.01 211
50 iOS - Objective-C 남아있는 메모리 공간 확인 방법 digipine 2017.11.01 215
49 iOS - NSString 와 NSData 간의 데이터 상호 변환 digipine 2017.11.01 249
48 [macOS] 현재 사용 중인(열려있는) 포트 확인하고 Close 하기 digipine 2022.10.24 258
47 iOS - Objective-C Callback for C++ digipine 2017.11.01 266
46 iOS - Query string을 Decode 하는 소스 digipine 2017.11.01 327
45 iOS - NSURLConnection로 다중 다운로드 구현 digipine 2017.11.01 333
44 iOS , MacOS, iPhone용 GZipStream class 구현하기 digipine 2017.11.01 357
43 Concurrent vs Serial DispatchQueue: Concurrency in Swift explained lizard2019 2021.04.16 415
42 iOS,OSX - CFSocket 사용법 digipine 2017.11.01 443
41 Apple AppStore App Review 시 Reject 피하기 위한 방법 digipine 2017.11.02 447
40 iOS - Objective - C 정규식 사용하기 digipine 2017.11.01 470
39 [iOS] 개발자를 위한 iOS 15의 새로운 기능 file digipine 2021.11.04 497
38 [macOS] Xcode 디버깅 시 Could not attach pid 오류 해결 file lizard2019 2023.06.05 507
37 iOS - View 이동 전환 하기 총정리 digipine 2017.11.01 537
36 [iOS] Audio Session Setting digipine 2021.11.26 548
Board Pagination Prev 1 2 3 Next
/ 3