xcode 5.1下编译使用librtmp

本文详细介绍了如何在Xcode 5.1环境下编译openssl和librtmp库,包括针对armv6和armv7架构的编译步骤,涉及配置终端命令、修改makefile文件以及设置编译选项等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 编译openssl

下载openssl, http://www.openssl.org/source/

我下载了openssl-1.0.1c ,解压。比如我解压到/Users/rick/rtmp/openssl下面

进入Terminal,执行

# cd /Users/rick/rtmp/openssl


(1)先编译armv6

# makdir openssl-armv6

# cd openssl-1.0.1c

./configure BSD-generic32 --openssldir=/Users/rick/rtmp/openssl/openssl-armv6

先把terminal放一边,我们进入openssl-1.0.1c目录里面,找到makefile,打开编辑,修改下面

#CC= gcc 改成 CC= /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6

# CFLAG=。。。里面多添加一项  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk

比如我的是:

CC= /Applications/Xcode.app/Contents/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 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk

(这里解释一下,/Applications/Xcode.app/Contents/Developer/usr/bin/gcc是我的gcc路径,通过命令行gcc -v命令就能查看到)

好了,修改好了,保存一下。继续terminal

# make

# make install


(2)接下来编译armv7

首先 #make clean   一下,不然会出错的。然后。。。

步骤和上面一样,只要openssl-armv6改成openssl-armv7,同样的,makefile里面也是CC= /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch armv7


(3)


2. 编译librtmp

下载rtmpdump,我下载的rtmpdump-2.3

解压后路径/Users/rick/rtmp/rtmpdump-2.3,拷贝,粘贴成

/Users/rick/rtmp/rtmp/rtmpdump-armv6  和  /Users/rick/rtmp/rtmp/rtmpdump-armv6

进入rtmpdump-armv6/librtmp

编辑makefile文件

CC=$(CROSS_COMPILE)gcc   改成 CC=$(CROSS_COMPILE)gcc -arch armv6

然后terminal执行命令

# export CROSS_COMPILE=/Applications/Xcode.app/Contents/Developer/usr/bin/

# export XCFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -I/Users/rick/rtmp/openssl/openssl-armv6/include/ -arch armv6"

# export XLDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -L/Users/rick/rtmp/openssl/openssl-armv6/lib -arch armv6"

make SYS=darwin

make SYS=darwin prefix=/Users/rick/rtmp/rtmp/rtmpdump-armv6 install

标记:/Users/rick/rtmp/openssl/openssl-armv6/include/ 是刚才已经编译好的openssl的路径, /Users/rick/rtmp/rtmp/rtmpdump-armv6是刚才拷贝rtmpdump后的路径




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值