configure: error: C preprocessor "arm-linux-gnueabihf-g++" fails sanity check

今天在交叉编译某个编解码库过程中碰到一个configure错误

运行configure的时候设置了一些配置项目

./configure CC=arm-linux-gnueabihf-gcc CPP=arm-linux-gnueabihf-g++ --host=arm-linux

  运行结果报错如下:

configure: error: C preprocessor "arm-linux-gnueabihf-g++" fails sanity check

  从我的配置意图来看g++是配置给CPP也就是C++的编译器,C的编译器配置的是gcc,从报错信息来看明显是把我的C++的编译器配置给了C,以前这样配置没碰到这种错误,于是上网搜索了一下,在stack Overflow上找到一篇有点苗头

https://stackoverflow.com/questions/15041937/configure-error-c-preprocessor-fails-sanity-check

The problem may well be that the GNU make implicit variable that denotes "your C++ compiler" is not CPP but CXX, whereas CPP is the implicit variable that denotes "your C preprocessor"; so your

 意思就是说要配置C++的编译器应该配置CXX,CPP已经默认是C的编译器选项。

所以更新后的配置如下

 

./configure CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ --host=arm-linux

  果然运行ok。

——————20190313于深圳南山科技工业园

原文地址:https://www.cnblogs.com/tid-think/p/10524917.html