【GMT5】Ubuntu16.04下安装GMT5.2.1报错non-floating-point argument in call to function __builtin_isnan

按照SeisMan提供的教程进行安装:GMT 5.2.1 在 Linux 下的安装

检查GMT 的依赖关系完毕后,开始编译和安装,使用

make -j

后出现如下问题:

error: non-floating-point argument in call to function '__builting_isnan'
(GMT_is_dnan (GMT->common.d.active[GMT_IN])) ? sprintf (e_value, "NaN") : sprintf (e_value, GMT->current.setting.format_float_out, GMT->common.d.nan_proxy[GMT_IN]);
......

1

GMT中文社区给了解决方法:GMT 5.2.1编译过程中NaN报错的解决办法。但是该网站未能被百度检索到,我搜索良久未能找到答案,无意浏览社区时候找到答案。解决方法贴出来:

在 Ubunut 16.04 或者其他比较新的 Linux 发行版下编译 GMT 5.2.1 的源码时,会出现如下错误而导致安装失败

non-floating-point argument in call to function '__builtin_isnan'

解决办法是,找到源码 gmt-5.2.1/src/xyz2grd.c,将第752行的

(GMT_is_dnan (GMT->common.d.active[GMT_IN])) ? sprintf (e_value, "NaN") : sprintf (e_value, GMT->current.setting.format_float_out, GMT->common.d.nan_proxy[GMT_IN]);

改成

(GMT->common.d.active[GMT_IN]) ? sprintf (e_value, GMT->current.setting.format_float_out, GMT->common.d.nan_proxy[GMT_IN]) : sprintf (e_value, "NaN");

再编译即可。

将这个错误解决了就能顺利的按照SeisMan的教程安装了,有一些地方不一样但似乎正常安装了。以下是不一样的地方:

  • 他是gshhg-gmt-2.3.5  我是2.3.4。
  • 检查软件的依赖关系时,我的ZLIB library为空,LAPACK library为no。
原文地址:https://www.cnblogs.com/shanchuan/p/8150328.html