Search code examples
iosxcodeterminalarmarmv7

Compiling to get armv7s slice


I am compiling libraries in the terminal with the following command to get an armv7 slice:

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

NOTE: I also change the ldflags, sysroot to provide the relevant path, although I don´t show that here to keep this short.

I have successfully generated code slices for: i686, i386 and armv7 and combined them, but I can´t get an armv7s slice.

What settings do I use for armv7s code slice?


Solution

  • You should specify -arch armv7s in CFLAGS. Below is what I use to build 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
    

    You could do something similar to get what you want.

    EDIT: How to call make with clang:

    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