赞
踩
环境:Mac OS 10.13.4 Xcode 9.3
1.下载最新LAME https://sourceforge.net/projects/lame/files/lame/,然后将下载好的文件夹改名为lame.然后在桌面新创建一个名字叫LAME文件夹将lame整个放到新建的文件夹里.
2.使用github上的一个shell脚本来进行编译出iOS版本库地址:https://github.com/kewlbear/lame-ios-build
3.将下载的build-lame.sh脚本放到LAME文件夹下和lame文件夹同级.
4.打开终端:
(1) cd ~/LAME 文件夹
(2) ./build-lame.sh
(3) 如果你看到EACCES: permission denied
这样的权限报错 执行 sudo chmod 777 ./build-lame.sh 再 执行 ./build-lame.sh
(4) xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance 这个是因为xcode路径被改变.
解决:
到finder里的应用程序找到Xcode然后使用右键打开:Xcode->显示包内容->Contents->Developer 然后把Developer文件夹拖到终端查看当前路径然后执行:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
再执行: ./build-lame.sh就行了
这样就看到了fat-lame文件夹下的.a和.h文件就是我们需要的了
(5) 找到存放libmp3lame.a的文件夹,执行 file libmp3lame.a
看到下面的信息就代表成功了:
libmp3lame.a: Mach-O universal binary with 5 architectures: [i386:current ar archive random library] [arm64]
libmp3lame.a (for architecture i386): current ar archive random library
libmp3lame.a (for architecture armv7): current ar archive random library
libmp3lame.a (for architecture armv7s): current ar archive random library
libmp3lame.a (for architecture x86_64): current ar archive random library
libmp3lame.a (for architecture arm64): current ar archive random library
用法:
1.cd 到lame文件夹
2.脚本放置于lame文件夹同级
3.执行../ceshi.sh就能得到支持armv7设备的库了
./configure \
--disable-shared \
--disable-frontend \
--host="arm-apple-darwin" \
--prefix="/Users/apple/Desktop/shells/lib/armv7" \
CC="xcrun -sdk iphoneos clang -arch armv7" \
CFLAGS="-arch armv7 -fembed-bitcode -miphoneos-version-min=7.0" \
LDFLAGS="-arch armv7 -fembed-bitcode -miphoneos-version-min=7.0"
make clean
make -j8
make install
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。