今天在交叉編譯某個編解碼庫過程中碰到一個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於深圳南山科技工業園