我正在尝试安装一些天文学软件包,特别是 cfitsio。同时使用“内置”mac gcc/g++ 编译器和 HPC 编译器时,出现以下错误:
configure: error: C preprocessor "/usr/local/bin/g++" fails sanity check
configure: error: C preprocessor "/usr/bin/g++" fails sanity check
$ /usr/local/bin/g++ --version
g++ (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /usr/bin/g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.2
Thread model: posix
按照建议,查看config.log
,结果相当不明确:
configure:3409: checking how to run the C preprocessor
configure:3479: result: /usr/local/bin/g++
configure:3499: /usr/local/bin/g++ conftest.c
conftest.c:14:8: error: 'Syntax' does not name a type
Syntax error
^
我的安装命令如下所示:
CPP=/usr/local/bin/g++ CXX=/usr/local/bin/g++ CC=/usr/local/bin/gcc CFLAGS="-arch x86_64 -g -O2" ./configure
CPP=/usr/bin/g++ CXX=/usr/bin/g++ CC=/usr/bin/gcc CFLAGS="-arch x86_64 -g -O2" ./configure
到目前为止,谷歌搜索尚未取得任何成果。我错过了什么或做错了什么?
最佳答案
答案是由 @n.m 确定的。注释中:环境变量CPP
被错误地设置为指向g++
,这当然是行不通的。 cpp
是我系统上 C 预编译器的名称。
关于macos - 在mac上编译: What does it mean if my compiler fails a sanity check?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22048505/