Linux 系统版本:Opensuse 13.2
GMT版本: GMT5.4.2
http://gmt.soest.hawaii.edu/projects/gmt/wiki/Download
下载,gshhg-gmt-2.3.7.tar.gz,dcw-gmt-1.1.2.tar.gz;
均放在一个目录下面如:/home/suse/software
根据README文件:
37 CMake
38 ----- 39 40 Install CMake (>=2.8.5) from http://www.cmake.org/cmake/resources/software.html 41 42 43 Install netCDF library 44 ---------------------- 45 46 For all major Linux distributions there are prepackaged development binaries 47 available. netCDF is also available on MacOSX trough the macports and fink 48 package managers. 49 50 Otherwise, get netCDF from http://www.unidata.ucar.edu/downloads/netcdf/. 51 You need at least version 4.0 with netCDF-4/HDF5 data model support (do not 52 disable HDF5/ZLIB in netCDF with --disable-netcdf-4). 53 54 Install CURL library 55 -------------------- 56 57 To handle URLs we depend on libcurl so install via your favorite package 58 manager if it is not intrinsic to your Unix installation. Otherwise, get 59 it from https://curl.haxx.se. 60 61 GDAL (optional) 62 --------------- 63 64 To use the GDAL interface (ability to provide grids or images to be imported 65 via gdal) you must have the GDAL library and include files installed. Like 66 netCDF, GDAL is available through your favorite package manager on many *NIX 67 systems. 68 69 70 PCRE (optional) 71 --------------- 72 73 To use the PCRE interface (ability to specify regular expressions in some 74 search options, e.g., gmtconvert) you must have the PCRE library and include 75 files installed. PCRE is available through your favorite package manager 76 on many *NIX systems. 77 78 79 LAPACK (optional) 80 --------------- 81 82 To greatly speed up some linear algebra calculations (greenspline in 83 particular) you must have the LAPACK library and include files installed. 84 LAPACK is available through your favorite package manager on many *NIX 85 systems or in the case of OS X is built in. 86 87 88 Install support data 89 --------------------
这里未安装 gdal、lapack等库
继续按照README.CMAKE的提示进行操作
在GMT5.4.2解压目录cmake文件夹下,复制ConfigUserTemplate.cmake重命名为ConfigUser.cmake;
修改ConfigUser.cmake文件, 去掉 GSHHG 和 DCW_ROOT两项的注释。
106 # Set path to GSHHG Shoreline Database [auto]:107 set (GSHHG_ROOT "gshhg_path")108 109 # Copy GSHHG files to $/coast [FALSE]:110 set (COPY_GSHHG TRUE)111 112 # Set path to DCW Digital Chart of the World for GMT [auto]:113 set (DCW_ROOT "dcw-gmt_path")114 115 # Copy DCW files to $/dcw [FALSE]:116 set (COPY_DCW TRUE)
然后在 ~/.bashrc 中增加两个变量
export GSHHG_ROOT=/home/suse/software/gshhg-gmt-2.3.7/ export DCW_ROOT=/home/suse/software/dcw-gmt-1.1.2/
创建目录build,
mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=RelWithDebInfo .. make install //这里我没有采用多线程运行 make -jx install
测试运行GMT命令
psxy pscoast ...
运行 gmt-5.4.2/doc/examples/ex01/example_01.sh
bash example_01.sh
运行结果:
正常运行即安装成功。