configure:error:C预处理器无法进行健全性检查

时间:2013-02-23 15:05:16

标签: linux compiler-errors configure icc

我正在Ubuntu 12.04 x86_64上编译几个库。首先,我使用GCC 4.7.2编译了这些库并且一切顺利。然后我尝试使用Inte Composer 2013 u2重新编译它们。我这样做的目的是:

export CC=/opt/intel/composer_xe_2013.2.146/bin/intel64/icc
export CPP=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

然后我运行./configure并收到以下错误:

checking how to run the C preprocessor... /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc
configure: error: in `/var/www/workspace/freetype/freetype-2.4.11/builds/unix':
configure: error: C preprocessor "/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc" fails sanity check
See `config.log' for more details
make: *** [setup] Error 1

配置日志文件包含此错误:

configure:3345: checking how to run the C preprocessor
configure:3415: result: /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc
configure:3435: /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc  conftest.c
conftest.c(14): error: identifier "Syntax" is undefined
             Syntax error
             ^

conftest.c(14): error: expected a ";"

compilation aborted for conftest.c (code 2)

configure:3435: $? = 2
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "FreeType"
| #define PACKAGE_TARNAME "freetype"
| #define PACKAGE_VERSION "2.4.11"
| #define PACKAGE_STRING "FreeType 2.4.11"
| #define PACKAGE_BUGREPORT "freetype@nongnu.org"
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|            Syntax error
configure:3435: /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc  conftest.c
conftest.c(14): error: identifier "Syntax" is undefined
             Syntax error
             ^

conftest.c(14): error: expected a ";"

compilation aborted for conftest.c (code 2)

这里有什么不妥?

3 个答案:

答案 0 :(得分:11)

问题很可能是GNU使隐式变量 表示“您的C ++编译器”不是CPP而是CXX,而CPP是 表示“你的C预处理器”的隐式变量;所以 您的

export CPP=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

告诉configure icpc是预处理器,大概是CXX 默认为g ++。

./configure错误支持

  

检查如何运行C预处理器... /opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

尝试:

export CXX=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

或只是:

./configure CXX=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

答案 1 :(得分:4)

FWIW,今天我遇到了这个,我的解决方案是

export CPP='<path to icpc> -E'

也就是说,告诉configure应该使用-E标志运行预处理器。

答案 2 :(得分:2)

谢谢Menno,在我的情况下,出口并没有完全做到但是它很接近。通过CPP = ...进行配置可以解决问题:

mkdir build
cd build
../configure --prefix=/usr/local/gcc/ CC=/usr/local/gcc/bin/gcc \
 CXX=/usr/local/gcc/bin/g++ CPP='/usr/local/gcc/bin/g++ -E'