无法为iOS编译LAME [英] Can't compile LAME for iOS
问题描述
我正在尝试将蹩脚的 mp3 编码器编译为适用于 iOS 的静态库.我想支持所有架构,包括i686,armv6,armv7,armv7s和arm64.这是我的构建脚本:
I'm trying to compile lame mp3 encoder as static library for iOS. I'd like to support all architectures including i686, armv6, armv7, armv7s and arm64. Here is my build script:
#!/bin/bash
DEVELOPER=`xcode-select -print-path`
SDK_VERSION="7.1"
mkdir build
function build_lame()
{
make distclean
./configure \
CFLAGS="-isysroot ${DEVELOPER}/Platforms/${SDK}.platform/Developer/SDKs/${SDK}${SDK_VERSION}.sdk" \
CC="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch ${PLATFORM} -miphoneos-version-min=7.0 " \
--prefix=/Users/mcrute/Desktop/lame \
--host="arm-apple-darwin9" \
--disable-shared \
--enable-static \
--disable-decoder \
--disable-frontend
make -j4
cp "libmp3lame/.libs/libmp3lame.a" "build/libmp3lame-${PLATFORM}.a"
}
SDK="iPhoneSimulator"
PLATFORM="i686"
build_lame
SDK="iPhoneOS"
PLATFORM="armv6"
build_lame
PLATFORM="armv7"
build_lame
PLATFORM="armv7s"
build_lame
PLATFORM="arm64"
build_lame
lipo -create build/* -output build/libmp3lame.a
所以错误看起来像这样:
So the error looks like this:
configure: error: in `/Users/ivan/Desktop/lame-3.99.5':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
cp: libmp3lame/.libs/libmp3lame.a: No such file or directory
此处是我的 config.log .|试图从构建目标中删除arm64,但脚本也失败,并出现相同的错误.Google说我还没有gcc,但是我有..寻找任何建议!
Here is my config.log. | tried to remove arm64 from build targets, but script also failed with same error. Google said that I haven't got gcc but I have.. Looking for any suggestion!
推荐答案
问题通过在configure函数中添加CPP =" * "变量解决.我的环境中错过了CPP.编辑后的构建脚本应如下所示:
The problem was solved by adding CPP="*" variable inside configure function. CPP was missed in my env. Edited build script should looks like this:
#!/bin/bash
DEVELOPER=`xcode-select -print-path`
SDK_VERSION="7.1"
mkdir build
function build_lame()
{
make distclean
./configure \
CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cpp" \
CFLAGS="-isysroot ${DEVELOPER}/Platforms/${SDK}.platform/Developer/SDKs/${SDK}${SDK_VERSION}.sdk" \
CC="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch ${PLATFORM} -miphoneos-version-min=7.0 " \
--prefix=/Users/ivan/Desktop/lame-3.99.5 \
--host="arm-apple-darwin9" \
--disable-shared \
--enable-static \
--disable-decoder \
--disable-frontend
make -j4
cp "libmp3lame/.libs/libmp3lame.a" "build/libmp3lame-${PLATFORM}.a"
}
PLATFORM="i686"
SDK="iPhoneSimulator"
build_lame
PLATFORM="armv6"
SDK="iPhoneOS"
build_lame
PLATFORM="armv7"
build_lame
PLATFORM="armv7s"
build_lame
PLATFORM="arm64"
build_lame
lipo -create build/* -output build/libmp3lame.a
这篇关于无法为iOS编译LAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!