macos - 在mac上编译: What does it mean if my compiler fails a sanity check?

标签 macos gcc

我正在尝试安装一些天文学软件包,特别是 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/

相关文章:

css - SVG 在 Mac 上的 Chrome 中显示,但在 Windows 上的 Chrome 中不显示

macos - NSPopover + NSBox 的深色模式色调/ Gamma 问题

c++ - .out 将 -c 指令与 g++ 一起使用时权限被拒绝

mysql - 无法在 Mac 上重置 MySQL root 密码

c++ - 对于不遵循 libNAME.so 命名约定的库,如何在没有 -l 或硬编码路径的情况下使用 GCC 链接?

osx 上的 python/pip 错误

c++ - 模板警告和错误帮助,(gcc)

c++ - 如何从链接器错误转到源代码中的代码行?

c++ - 包含头文件时,路径是否区分大小写?

c++ - ld64.so 存在于 ldd 中,在运行时丢失