Compilation iOS编译(armv7、i386)多个LIB。配置脚本:C预处理器未通过健全性检查

Compilation iOS编译(armv7、i386)多个LIB。配置脚本:C预处理器未通过健全性检查,compilation,ios5,preprocessor,cross-compiling,configure,Compilation,Ios5,Preprocessor,Cross Compiling,Configure,我已经为iOS做了很多不同库的交叉编译,直到iOS5都没有问题。好的,显然我的问题是,iOS5 SDK不再包含GNU gcc编译器。只有llvm和clang可用 我的问题是,我无法再运行任何库的“配置”脚本。它总是在以下情况下失败: configure: error: C preprocessor "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check gcc只是指向llvm编译器的符

我已经为iOS做了很多不同库的交叉编译,直到iOS5都没有问题。好的,显然我的问题是,iOS5 SDK不再包含GNU gcc编译器。只有llvm和clang可用

我的问题是,我无法再运行任何库的“配置”脚本。它总是在以下情况下失败:

configure: error: C preprocessor 
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check
gcc只是指向llvm编译器的符号链接。如果我将其设置为“叮当”,则会产生相同的错误。(只是有更好的语法错误表示)

下面是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.
几个星期来我一直在想这个问题,但是运气不好。我觉得其他人一定遇到过这个问题。但谷歌没有提出任何建议。有一段时间,我试图使用gas-preprocessor.pl,但也没有任何运气

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

./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin
我想指出,我所有使用配置脚本的库都会出现这个问题。举几个例子:apr、apr util、expat、log4cxx等。。。我甚至不确定期望的输出应该是什么。在代码中间有一个奇怪的“语法错误”。难怪它不编译:)

如果您能提供帮助和提示,我们将不胜感激。
谢谢。

我遇到了同样的问题。经过一番戳戳之后,我的问题是我明确地设置了
CPP
。不要设置它(事实上,如果设置了,就“取消设置”)。如果未设置,则默认情况下配置尝试
$CC-E
。如果设置了
configure
不会自动添加
-E
。另外,将
CPPFLAGS
设置为
-E
也不起作用,因为这些标志也会传递到其他步骤。

如果我将
-E
手动添加到引发错误的gcc调用中,那么我实际上可以跳过此错误。但接着它又遇到了下一个:)。太好了。我不得不取消CPP和CPP标志的设置。非常感谢,它现在工作得很好。那么系统如何使用哪种编译器(因为您是交叉编译的)?也许我错过了什么?
./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin