我正在尝试编译lame mp3编码器作为iOS的静态库。我想支持所有架构,包括i686,armv6,armv7,armv7s和arm64。这是我的构建脚本:
#!/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
所以错误看起来像这样:
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
Here是我的 config.log 。 |尝试从构建目标中删除arm64,但脚本也失败并出现相同的错误。谷歌说我没有gcc,但我有..寻找任何建议!
答案 0 :(得分:1)
通过在configure函数中添加CPP =“ * ”变量来解决问题。我的环境中错过了CPP。编辑的构建脚本应如下所示:
#!/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
答案 1 :(得分:0)
从评论到回答。
由于某种原因, CPP
被设置为非常奇怪的值。
您正在手动将配置行上的CC
设置为XcodeDefault
内的路径。
尝试在配置调用中将CPP
设置为cpp
内的相应XcodeDefault
二进制文件。