首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >配置:错误:C预处理器无法进行健全性检查

配置:错误:C预处理器无法进行健全性检查
EN

Stack Overflow用户
提问于 2013-02-23 23:05:16
回答 3查看 18.9K关注 0票数 9

我正在Ubuntu12.04 x86_64上编译几个库。首先,我用GCC 4.7.2编译了这些库,一切都很顺利。然后我尝试用Inte Composer 2013 u2重新编译它们。为此,我这样做了:

代码语言:javascript
复制
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,得到以下错误:

代码语言:javascript
复制
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

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

代码语言:javascript
复制
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)

这里会有什么问题呢?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-02-28 06:40:40

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

代码语言:javascript
复制
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

尝试:

代码语言:javascript
复制
export CXX=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc

或者只是:

代码语言:javascript
复制
./configure CXX=/opt/intel/composer_xe_2013.2.146/bin/intel64/icpc
票数 16
EN

Stack Overflow用户

发布于 2015-08-05 18:41:00

顺便说一句,我今天遇到了这个问题,我的解决方案是

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

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

票数 9
EN

Stack Overflow用户

发布于 2016-08-11 14:30:27

谢谢Menno,在我的例子中,导出没有做到这一点,但已经很接近了。正在通过CPP=...要进行配置,请执行以下操作:

代码语言:javascript
复制
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'
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15041937

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档