我正在使用以下命令在终端中编译库以获取 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/