ios - 为 iOS 编译库

标签 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

最佳答案

试试这个。它修复了您遇到的 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

关于ios - 为 iOS 编译库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18900381/

相关文章:

c++ - 使用 g++ 在 AIX 上编译 pthread.h 东西

ios - 使用 SpriteKit 和 UITextView 的 UITextSelectionView 名称无法识别的选择器

ios - Rails如何在chrome ios上强制下载

ios - Swift:如何为不带参数的 UIAlertController 创建一个方便的 init

bash - 在 Mac OS X 上删除整个 USB 驱动器

c++ - 什么是 OSX 等同于 Linux g++-multilib 的?

c++ - 在 Win8 中使用 GCC、C::B 安装 Ogre3D

ios - Bitrise 正在尝试使用错误的配置文件对嵌入式框架进行代码签名

c++ - OSX 磁盘仲裁链接器错误

c++ - fread() 调用后的段错误