XCode6 编译opencore-amr

注:近几天需要将amr转换为wav,从搜到了好些编译opencore-amr教程,然后看到了这个帖子《编译opencore-amr for iOS》,但是该贴子中的方法xcode6中行不通,原因是xcode6的sdk路径变化了,然后修改了其路径,i386编译成功其他就失败提示GCC编译出错,然后无果。后来又搜到了下面的这个帖子《XCode6编译opencore ,帖子中提示如果出现编译错误,要下载最新的command line tools”,才知道要安装command line tools(命令行工具)。安装后编译成功了。 


编译前准备

    1、要安装command line tools。安装方法:打开终端,输入命令:xcode-select --install 。参见:http://blog.csdn.net/sqc3375177/article/details/23662755

      2、下载opencore-amr-0.1.3.tar.gz并解压。官网: http://sourceforge.net/projects/opencore-amr/

编译步骤(转自XCode6编译opencore

将下面脚本拷贝并到build.sh文件中保存到opencore-amr库根目录下,修改build.sh文件权限为可执行,运行./build.sh则可以编译出支持xcode6下模拟器及真机执行库。

其生成的头和库文件在桌面opencore-amr-lib-store目录下. 希望对要移植的朋友有帮助.

然后修改为有可运行chmod 777 build.sh

如果出现编译错误,要下载最新的command line tools


#!/bin/sh


#xcode6.0.1 iOS8
set -xe


VERSION="0.1.3"
SDKVERSION="8.1"


DEVELOPER=`xcode-select -print-path`
#CURRENTDIR =`pwd`


DEST=${HOME}/Desktop/opencore-amr-lib-store
ARCHS="i386 x86_64 armv7 armv7s arm64"
LIBS="libopencore-amrnb.a libopencore-amrwb.a"


for arch in $ARCHS; do
case $arch in
arm*)

echo "Building opencore-amr for iPhone $arch ****************"
PLATFORM="iPhoneOS"
PATH="${DEVELOPER}/usr/bin:$PATH"
SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
#FRMWORKS = "${SDK}/System/Library/Frameworks"
#PRVFRMWORKS = "${SDK}/System/Library/PrivateFrameworks"
CC="gcc -arch $arch --sysroot=$SDK -F $FRMWORKS" \
CXX="g++ -arch $arch --sysroot=$SDK" \
LDFLAGS="-Wl,-syslibroot,$SDK" ./configure \
--host=arm-apple-darwin --prefix=$DEST \
--disable-shared
;;
*)
PLATFORM="iPhoneSimulator"
PATH="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/usr/bin:$PATH"
SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
echo "Building opencore-amr for iPhoneSimulator $arch*****************"
CC="gcc -arch $arch" CXX="g++ -arch $arch" \
./configure \
--prefix=$DEST \
--disable-shared
;;
esac
make -j3
make install
make clean
for i in $LIBS; do
mv $DEST/lib/$i $DEST/lib/$i.$arch
done
done


for i in $LIBS; do
input=""
for arch in $ARCHS; do
input="$input $DEST/lib/$i.$arch"
done
lipo -create -output $DEST/lib/$i $input
done

发布了20 篇原创文章 · 获赞 5 · 访问量 2万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览