为iOS编译库

时间:2013-09-19 16:38:12

标签: ios macos gcc lame darwin

我之前使用this作为指南为iOS安装了lame。

我现在正尝试与TwoLame做类似的事情。

不幸的是我没有成功。

mkdir build

function build_lame()
{
    make distclean

    ./configure \
        CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${SDK}.platform/Developer/SDKs/${SDK}${SDK_VERSION}.sdk" \
        CC="/Applications/Xcode.app/Contents/Developer/Platforms/${SDK}.platform/Developer/usr/bin/gcc -arch ${PLATFORM}" \
        --prefix=/Users/jonathan/Desktop/twolame \
        --host="arm-apple-darwin9" \
        --disable-shared \
        --enable-static \

    make
    cp "libtwolame/.libs/libtwolame.a" "build/libtwolame-${PLATFORM}.a"
}

PLATFORM="i686"
SDK="iPhoneSimulator"
build_lame

PLATFORM="armv7"
SDK="iPhoneOS"
build_lame

PLATFORM="armv7s"
build_lame

lipo -create build

我看到的当前错误是:

 configure: error: C compiler cannot create executables

1 个答案:

答案 0 :(得分:1)

试试这个。它修复了你的C编译器问题以及其他一些关于SDK和GCC的不同路径的问题,并允许你现在构建所有三个平台。

mkdir -p build
rm -rf build/* #*/

function build_lame()
{
    make distclean

    ./configure \
        CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${SDK}.platform/Developer/SDKs/${SDK}${SDK_VERSION}.sdk" \
        CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch ${PLATFORM} -miphoneos-version-min=7.0" \
        --prefix="/Users/$USER/Desktop/twolame" \
        --host="arm-apple-darwin9" \
        --disable-shared \
        --enable-static \

    make
    cp "libtwolame/.libs/libtwolame.a" "build/libtwolame-${PLATFORM}.a"
}

SDK_VERSION=7.0

PLATFORM="i386"
SDK="iPhoneSimulator"
build_lame

PLATFORM="armv7"
SDK="iPhoneOS"
build_lame

PLATFORM="armv7s"
SDK="iPhoneOS"
build_lame

lipo -create build