ios - 编译得到armv7s slice

标签 ios xcode terminal arm armv7

我正在使用以下命令在终端中编译库以获取 armv7 切片:

./configure CC=/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 --host=arm

注意:我还更改了 ldflags 和 sysroot 以提供相关路径,尽管我没有在此处显示以保持简短。

我已经成功地为 i686、i386 和 armv7 生成了代码片并将它们组合在一起,但是我无法获得 armv7s 片。

我为 armv7s 代码片使用什么设置?

最佳答案

您应该在CFLAGS 中指定-arch armv7s。下面是我用来构建 ICU 的内容:

INSTALL=`pwd`/..

if [ $# -eq 0 ]
then
    $0 armv7 iPhoneOS
    $0 armv7s iPhoneOS
    $0 i386 iPhoneSimulator
    mkdir -p $INSTALL/universal/lib
    cd $INSTALL/armv7/lib
    for f in *.a
    do
        echo $f
        xcrun -sdk iphoneos lipo -output ../../universal/lib/$f -create -arch armv7 $f -arch armv7s ../../armv7s/lib/$f -arch i386 ../../i386/lib/$f
    done
    #cd ../..
else
    echo $1 $2
    ARCH=$1
    PLATFORM=$2
    TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export CC="$TOOLCHAIN/usr/bin/clang"
    DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/$PLATFORM.platform/Developer
    SDK=6.1
    SDKROOT=$DEVROOT/SDKs/$PLATFORM$SDK.sdk
    export CFLAGS="-arch $ARCH -isysroot $SDKROOT -miphoneos-version-min=5.0 -I/Users/xxx/icu/source/tools/tzcode"
    export CXXFLAGS="$CFLAGS" 

    gnumake distclean

    ../../icu/source/configure --host=arm-apple-darwin --enable-static --disable-shared --with-cross-build=/Users/xxx/icu-build/mac --prefix=$INSTALL/$ARCH

    gnumake
    gnumake install
fi

您可以做类似的事情来获得您想要的。

编辑:如何用 clang 调用 make:

export CFLAGS=-arch armv7s # add more compiler flags as needed here
export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
make

关于ios - 编译得到armv7s slice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17893378/

相关文章:

ios - 将 Xib 添加为 subview 时,Xib 框架大小不正确

C++ 命令行大小

objective-c - 没有子类化 UIView 或 UIViewController : possible to catch if a subview was added?

ios - 为 Xcode 4 创建跨项目引用时遇到问题

iphone - Flurry User ID 是邪恶的吗?

ios - 从NSStrings中提取数字

shell - 为什么在使用 rmdir 时在终端中出现 "Directory not empty"错误?

linux - 当您在过程中按终端中的向右箭头时,会显示 "^[[C"。到底是什么意思?

iphone - 如何打印ASIHTTPRequest的原始数据

ios - 重建项目时缓存图像 url 不存在