gpt4 book ai didi

compilation - iOS 编译几个库(armv7、i386)。配置脚本 : C preprocessor fails sanity check

转载 作者:行者123 更新时间:2023-12-04 03:33:49 24 4
gpt4 key购买 nike

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

我的问题是,我无法再完成运行任何库的“配置”脚本。它总是失败:

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

gcc only 是 llvm 编译器的符号链接(symbolic link)。如果我将其设置为 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.

这是我的环境。有点矫枉过正,但它在 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

几周以来我一直试图解决这个问题,但没有运气。我觉得其他人一定遇到过这个问题。但谷歌没有提出任何东西。有一段时间,我尝试使用gas-preprocessor.pl,但也没有任何运气。

啊,我的配置调用总是与此类似:
./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin

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

将不胜感激有关如何进行的帮助和提示。
谢谢。

最佳答案

我遇到了同样的问题。经过一番戳,我的问题原来是我正在设置 CPP明确地。不要设置它(事实上,如果设置了,就'取消'它)。如果没有设置,configure 会尝试 $CC -E默认情况下。如果是设置,configure不添加 -E自动地。此外,设置 CPPFLAGS-E不起作用,因为这些标志也会传递给其他步骤。

关于compilation - iOS 编译几个库(armv7、i386)。配置脚本 : C preprocessor fails sanity check,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8478462/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com