首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在macOS上安装wgrib2时出现获取配置错误

在macOS上安装wgrib2时出现获取配置错误
EN

Stack Overflow用户
提问于 2017-12-04 08:59:58
回答 1查看 1.5K关注 0票数 5

我正在尝试在macOS Sierra上安装wgrib2。我已经按照this blog上的说明操作了。以下是终端中发生的情况:

代码语言:javascript
复制
rm tmpaec.tar
cd "/usr/local/grib2/libaec-1.0.0" && export CFLAGS="-I/usr/local/grib2/include -Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security --fast-math -O3 -DGFORTRAN -fopenmp -I/usr/local/grib2/jasper-1.900.1/src/libjasper/include -I/usr/include " && ./configure --disable-shared --prefix=/usr/local/grib2 && make check install
checking build system type... x86_64-apple-darwin16.7.0
checking host system type... x86_64-apple-darwin16.7.0
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/usr/local/grib2/libaec-1.0.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [/usr/local/grib2/lib/libaec.a] Error 77

下面是我在config.log中可以读到的内容:

代码语言:javascript
复制
configure:2882: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:2893: $? = 1
configure:2882: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:2893: $? = 1
configure:2913: checking whether the C compiler works
configure:2935: gcc -I/usr/local/grib2/include -Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security --fast-math -O3 -DGFORTRAN -fopenmp -I/usr/local/grib2/jasper-1.900.1/src/libjasper$
clang: error: unsupported option '--fast-math'
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
configure:2939: $? = 1
configure:2977: result: no
configure: failed program was:

我如何解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2019-06-24 23:27:12

根据您看到的clang: error:代码行,您使用的不是gcc,而是clang

Clang将自己描述为与gcc兼容的编译器,但它不是gcc。正如你链接的博客文章所指出的,在libaec的情况下,clang可能会触发构建错误。新创建的气候预测中心发布了wgrib2,如果你正在用clang构建wgrib2,它有specific recommendations,但我还没能让它工作。

最好的解决方案是用gcc代替。您链接到的blog post确实包含使用homebrew进行安装的说明

代码语言:javascript
复制
brew install gcc

然后按照wgrib2的构建说明进行操作:

代码语言:javascript
复制
export CC=gcc-9   # Use the version listed in `ls /usr/local/bin/gcc-*`, not clang gcc
export FC=gfortran
make

这将解决您的libaec问题,然后wgrib2应该会成功编译。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47625093

复制
相关文章

相似问题

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