无法在支持SIMD / NEON的Xcode 5 / Clang工具链上为iOS编译libjpeg-turbo

时间:2013-10-24 17:06:55

标签: ios xcode clang libjpeg-turbo

看起来使用Xcode 5和删除LLVM-GCC-4.2并将其替换为Clang,在编译NEON支持期间,为iOS设备构建libjpeg-turbo现在失败了。

配置步骤:

export PLATFORM="iPhoneOS"
export IPHONE_SDK="7.0"
export IPHONE_MIN_VERSION="5.0"

export DEVELOPER=`xcode-select --print-path`
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk"
export CC=`xcrun -find gcc`
export LD=`xcrun -find ld`
export IOS_CFLAGS="-arch armv7"
export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}"
export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}"
export CPPFLAGS="${CFLAGS}"
export CFLAGS="${CFLAGS} -miphoneos-version-min=${IPHONE_MIN_VERSION}"

./configure --with-jpeg8 --host arm-apple-darwin --enable-static --disable-shared
...
checking if we have SIMD optimisations for cpu type... yes (arm)
checking if the assembler is GNU-compatible and can be used... yes
...

构建步骤:

make -j4
    /Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in java
echo timestamp > classnodist_noinst.stamp
Making all in simd
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -E -I.. -I../simd ./jsimdcfg.inc.h | grep -E "^[\;%]|^\ %" | sed 's%_cpp_protection_%%' | sed 's@% define@%define@g' > jsimdcfg.inc
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
if /bin/sh ../libtool --mode=compile --tag=CC /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..  -I..  -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk  -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -MT jsimd_arm.lo -MD -MP -MF ".deps/jsimd_arm.Tpo" -c -o jsimd_arm.lo jsimd_arm.c; \
    then mv -f ".deps/jsimd_arm.Tpo" ".deps/jsimd_arm.Plo"; else rm -f ".deps/jsimd_arm.Tpo"; exit 1; fi
/bin/sh ../libtool --mode=compile gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/usr/bin/gcc  -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -c -o jsimd_arm_neon.lo jsimd_arm_neon.S
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
make[3]: *** [jsimd_arm_neon.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
 /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -O3 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.0 -MT jsimd_arm.lo -MD -MP -MF .deps/jsimd_arm.Tpo -c jsimd_arm.c -o jsimd_arm.o
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

知道怎么解决这个问题吗?如果禁用SIMD支持,构建会成功,但这显然不是很好。

2 个答案:

答案 0 :(得分:1)

它已由libjpeg-turbo的维护者修复: http://sourceforge.net/mailarchive/message.php?msg_id=31902025

我们需要的是一种特殊的CLANG兼容型气体预处理器: http://sourceforge.net/p/libjpeg-turbo/code/HEAD/tree/gas-preprocessor/

答案 1 :(得分:0)

在OSX上对iOS进行交叉编译时存在一个已知问题: http://sourceforge.net/mailarchive/message.php?msg_id=30462917

简而言之,您需要运行

  

$ autoreconf -fiv

在运行configure之前,在libjpeg-turbo目录中

在OSX 10.9和Xcode 5上,下面是成功编译lib所需的工具版本。较新的版本无法使用。

  • autoconf 2.69
  • nasm 2.08.01
  • automake 1.13

或者,您可以使用DMG附带的预构建二进制文件: http://sourceforge.net/mailarchive/forum.php?thread_name=5255ABCE.8070705%40users.sourceforge.net&forum_name=libjpeg-turbo-users