iOS编译(armv7,i386)的几个lib。配置脚本:C预处理器失败健全检查 [英] iOS Compiling (armv7, i386) of several libs. Configure Script: C preprocessor fails sanity check

查看:298
本文介绍了iOS编译(armv7,i386)的几个lib。配置脚本:C预处理器失败健全检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在做很多交叉编译不同的图书馆的iOS,直到iOS5没有问题。好吧,显然我的问题是,iOS5 SDK不包括GNU gcc编译器了。只有llvm和clang可用。



我的问题是,我不能完成运行任何库的'configure'脚本。它总是失败:

  configure:error:C preprocessor 
/Developer/Platforms/iPhoneOS.platform/Developer / usr / bin / gcc失败正确检查

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



这里config.log的重要部分:

 配置:3338:检查如何识别依赖库
configure:3514:result:pass_all
configure:3993:检查如何运行C预处理器
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 '或'__attribute__'before'error'
configure:4141:$? = 1
configure:失败的程序是:
| / * confdefs.h。 * /
|
| #define PACKAGE_NAMEexpat
| #define PACKAGE_TARNAMEexpat
| #define PACKAGE_VERSION2.0.1
| #define PACKAGE_STRINGexpat 2.0.1
| #define PACKAGE_BUGREPORTexpat-bugs@libexpat.org
| / * end confdefs.h。 * /
| #ifdef __STDC__
| #include< limits.h>
| #else
| #include< assert.h>
| #endif
|语法错误
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'或'__attribute__'before'error'
configure:4141: $? = 1
configure:失败的程序是:
| / * confdefs.h。 * /
|
| #define PACKAGE_NAMEexpat
| #define PACKAGE_TARNAMEexpat
| #define PACKAGE_VERSION2.0.1
| #define PACKAGE_STRINGexpat 2.0.1
| #define PACKAGE_BUGREPORTexpat-bugs@libexpat.org
| / * end confdefs.h。 * /
| #ifdef __STDC__
| #include< limits.h>
| #else
| #include< assert.h>
| #endif
|语法错误
configure:4210:错误:C预处理器/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc失败正确性检查
有关详细信息,请参阅`config.log'。

这里是我的环境。

 #定义
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 / gcc
export LD = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / ld
export RANLIB = / Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / ranlib
export ARIBM = / 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

我一直在想这个数周,但没有运气。我觉得别人一定碰到这个问题。但谷歌没有提出任何东西。一段时间,我试图使用gas-preprocessor.pl,但也没有任何运气。



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

  ./ configure --prefix = $ INSTALL_DIR --disable-shared --enable-static --host = arm-apple-darwin 

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



帮助和提示如何进行将非常感谢。
谢谢。

解决方案

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

I've been doing a lot of cross-compiling of different libraries for iOS and until iOS5 there was no problem. Ok, apparently my problem is, that the iOS5 SDK does not include the GNU gcc compiler any more. Only llvm and clang are available.

My problem is, that I cannot finish to run the 'configure' script of any library any more. It always fails with:

configure: error: C preprocessor 
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check

gcc only is a symbolic link to the llvm compiler. If I set it to clang, it produces the same error. (Just with a nicer syntax error representation)

Here the important part of 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.

Here's my environment. A little overkill, but it worked fine with 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

I've been trying to figure this out for weeks, but no luck. I feel other people must have come across this problem. But Google did not bring up anything. For a time, I tried to use the gas-preprocessor.pl, but also without any luck.

Ah, my configure calls are always similar to this:

./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin

I want to point out that this exact problem happens with all my libraries that use configure scrips. To name a few: apr, apr-util, expat, log4cxx etc... I'm not even sure what the desired output should be. There's just a weirdly placed 'Syntax error' in the middle of the code. No wonder it does not compile :).

Help and tips on how to proceed would be greatly appreciated. Thanks.

解决方案

I ran into the same issue. After some poking, my problem turned out to be that I was setting CPP explicitly. Don't set that (and in fact, 'unset' it if it's set). If it's not set, configure tries $CC -E by default. If it is set, configure doesn't add the -E automatically. Also, setting CPPFLAGS to -E doesn't work, because these flags are also passed to other steps.

这篇关于iOS编译(armv7,i386)的几个lib。配置脚本:C预处理器失败健全检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆