Question

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?

Was it helpful?

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

OTHER TIPS

I've combined the crt.1.x.x.0, libarclite, and libclang Xcode of the three current device architectures in order to support armv6, armv7, and armv7s for my iOS app.

Original Stack Overflow post that helped me: https://stackoverflow.com/a/12836808/761902.

Since you are trying to compile a ARM (conventional iOS device) and Intel (OS X computer) architectures into one file, you can try getting the crt, libarclite, and libclang files specified in the original post.

As the ARM files were located under Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/,

I would expect the equivalent i386 files to be located under Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/ , I'm not sure what Xcode build platform i686 falls under since I don't recall seeing that before, but if it is a iPhoneSimulator.platform, it would be in the same files as the i386 platform.

You might also want to add i686 and i386 to your build settings. The below are my architecture settings for building for armv6, armv7, and armv7s. Xcode build settings

If that doesn't work, you can also build i686, i386, and armv7s separately and merge the built binaries with lipo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top