iOS编译(armv7,i386)的几个库.配置脚本:C预处理器无法进行健全性检查

rad*_*x54 9 preprocessor compilation configure cross-compiling ios5

我一直在为iOS进行大量的不同库的交叉编译,直到iOS5没有问题.好吧,显然我的问题是,iOS5 SDK不再包含GNU gcc编译器了.只有llvm和clang可用.

我的问题是,我无法完成运行任何库的'configure'脚本.它始终失败:

configure: error: C preprocessor 
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check
Run Code Online (Sandbox Code Playgroud)

gcc只是llvm编译器的符号链接.如果我将其设置为clang,则会产生相同的错误.(只是使用更好的语法错误表示)

这是config.log的重要部分:

configure:3338: checking how to recognise dependent libraries
configure:3514: result: pass_all
configure:3993: checking how to run the C preprocessor
configure:4111: result: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
configure:4135: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv7 -miphoneos-version-min=5.0 -gdwarf-2 -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system conftest.c
conftest.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'error'
configure:4141: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "expat"
| #define PACKAGE_TARNAME "expat"
| #define PACKAGE_VERSION "2.0.1"
| #define PACKAGE_STRING "expat 2.0.1"
| #define PACKAGE_BUGREPORT "expat-bugs@libexpat.org"
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|            Syntax error
configure:4135: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv7 -miphoneos-version-min=5.0 -gdwarf-2 -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system conftest.c
conftest.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'error'
configure:4141: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "expat"
| #define PACKAGE_TARNAME "expat"
| #define PACKAGE_VERSION "2.0.1"
| #define PACKAGE_STRING "expat 2.0.1"
| #define PACKAGE_BUGREPORT "expat-bugs@libexpat.org"
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|            Syntax error
configure:4210: error: C preprocessor "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check
See `config.log' for more details.
Run Code Online (Sandbox Code Playgroud)

这是我的环境.有点矫枉过正,但它在iOS4.X中运行良好.

# Defines
DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneOS5.0.sdk

# BUILD STUFF
export CXXFLAGS="-B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv7 -miphoneos-version-min=5.0 -gdwarf-2 -mthumb -isysroot $SDKROOT -L$SDKROOT/usr/lib/system"
export CPPFLAGS="$CXXFLAGS"
export CFLAGS="$CXXFLAGS"
export CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
export CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++
#export CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
export LD=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld
export RANLIB=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib
export AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
export STRIP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip
export LIBTOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool
export INSTALL_DIR=/Users/mriedel/MPI/CrossCompiling/armv7_dev_install
export CPATH=$INSTALL_DIR/include
export LIBRARY_PATH=$INSTALL_DIR/lib
Run Code Online (Sandbox Code Playgroud)

我已经试图解决这个问题好几个星期,但没有运气.我觉得其他人一定遇到过这个问题.但谷歌没有提出任何建议.有一段时间,我试图使用gas-preprocessor.pl,但也没有任何运气.

啊,我的配置调用总是类似于:

./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin
Run Code Online (Sandbox Code Playgroud)

我想指出,所有使用configure scrips的库都会出现这个确切的问题.仅举几例:apr,apr-util,expat,log4cxx等......我甚至不确定所需的输出应该是什么.在代码中间只有一个奇怪的"语法错误".难怪它不编译:).

非常感谢有关如何继续的帮助和提示.谢谢.

小智 13

我遇到了同样的问题.经过一番探讨,我的问题结果是我CPP明确地设置了.不要设置(事实上,如果设置的话,"取消设置"它).如果未设置,则$CC -E默认配置尝试.如果设置,configure则不会-E自动添加.此外,设置CPPFLAGS-E不起作用,因为这些标志也传递给其他步骤.