GMTはnetcdfというlibraryを使いますので,GMTそのもののインストールの前に,netcdfをインストールする必要があります。
1.netcdf-3.5aのインストール
(ポイント)
●compile option用の環境変数の設定
netcdf-3.5a.tar.Z を展開するとsrcというディレクトリにINSTALLという文書がある。このINSTALLのLinuxのところに書いてある通りにすればよい。以下はcsh系の例である(setenvで環境変数を指定する)。
Fortran compilerとしてg77がインストールされているなら,以下のようにすればよい。
setenv CC /usr/bin/gcc
setenv CPPFLAGS -Df2cFortran
setenv CFLAGS -g
setenv FC /usr/bin/g77
setenv FFLAGS "-g -Wno-globals"
setenv CXX /usr/bin/g++
Fortran compilerとしてfort77がインストールされているなら,以下のようにすればよい。
# setenv CC /usr/bin/gcc
# setenv CPPFLAGS -Df2cFortran
# setenv CFLAGS -g
# setenv FC /usr/bin/fort77
# setenv FFLAGS "-g -Nx400 -w"
# setenv CXX /usr/bin/c++
Vine2.0CRではデフォルト(?)ではg77は入らなかったのでCD-ROM中のrpmファイルを後でインストールした。fort77はVine2.0CRには(CD-ROMにも)収録されていないので,これはftpサイトからSRPMファイルをとってきてrebuildしてインストールした。
●ln -sf netcdf-3.5a netcdf とリンクを張る
(コマンドの実際:出力省略)
[root@sc210]# /bin/csh (← shellがcsh系でなければcshに変更)
[root@sc210]# cd /usr/local
[root@sc210]# gzip -cd netcdf-3.5a.tar.Z | tar xvf -
[root@sc210]# ln -sf netcdf-3.5a netcdf
[root@sc210]# cd netcdf
[root@sc210]# cd src
[root@sc210]# setenv CC /usr/bin/gcc
[root@sc210]# setenv CPPFLAGS -Df2cFortran
[root@sc210]# setenv CFLAGS -g
[root@sc210]# setenv FC /usr/bin/g77
[root@sc210]# setenv FFLAGS "-g -Wno-globals"
[root@sc210]# setenv CXX /usr/bin/g++
[root@sc210]# ./configure
[root@sc210]# make
[root@sc210]# make test
[root@sc210]# make install
2.GMT3.1.1のインストール
(ポイント)
元のtar ballのうち,GMT_full.tar.gzとGMT_high.tar.gzの中味は
binned_GSHHS_f.cdf binned_border_f.cdf binned_river_f.cdf
binned_GSHHS_h.cdf binned_border_h.cdf binned_river_h.cdf
というファイルだが,これは本来/usr/local/GMT3.1/libの下に置かれないといけないのに,/usr/localで展開すると/usr/local/libに置かれてしまう。なので手で移してやらないといけない。
(コマンドの実際:出力省略)
[root@sc210]# cd /usr/local
[root@sc210]# mkdir -p GMT3.1/man/manl (←なぜか作ってくれないので手で作る)
[root@sc210]# tar xvzf GMT_doc.tar.gz
[root@sc210]# tar xvzf GMT_full.tar.gz
[root@sc210]# tar xvzf GMT_high.tar.gz
[root@sc210]# mv lib/binned* GMT/3.1/lib (←正しい場所に移してやる)
[root@sc210]# tar xvzf GMT_lib.tar.gz
[root@sc210]# tar xvzf GMT_progs.tar.gz
[root@sc210]# tar xvzf GMT_scripts.tar.gz
[root@sc210]# tar xvzf GMT_suppl.tar.gz
[root@sc210]# chmod +x install_gmt
[root@sc210]# ./install_gmt (←インストール用スクリプト:対話的にインストールできます)
(install_gmt実行後の入力事項)
[root@sc210]# ./install_gmt
----------------------------------------------------------------
Installation of GMT, the Generic Mapping Tools, version 3.1
You MUST have write privileges in the directories you specify.
Older files in those directories will be overwritten.
----------------------------------------------------------------
If you have an existing GMT installation and you are installing
this new version in the same directory tree, we suggest that you
copy the makefile and the gmt_defaults.h files to a safe place
before unpacking the tar archives. The gmtdefaults parameters
have changed in 3.1, so you cannot replace the gmt_defaults.h on
the 3.1 tarfile with your old one; however, you may want to refer
to the old one to customize any variables.
Also, the install script will put you in vi to edit the makefile
macros, and you may want to refer to your old 3.0 makefile to see
which compiler switches are needed at your site.
==> Hit return when ready to continue:
+++ Will expand *.bz2 files made with bzip2 +++
GMT must be linked with the netCDF library
==> Have you installed netcdf version 3.4 or later? (y/n) [y]: y
==> Want to ftp and get any of the GMT version archives? (y/n) [y]: n
Set write privileges on all files in GMT3.1 ...Done
==> Enter directory with netcdf subdirs include and lib [/usr/local/netcdf]:
==> Enter path (from /) to where GMT data will be stored [/usr/local/GMT3.1/lib]:
All users must setenv GMTHOME /usr/local/GMT3.1
==> Enter directory where GMT executables should be stored /usr/local/GMT3.1/bin]:
All users must include /usr/local/GMT3.1/bin in their path
The answer to the following question will modify the GMT defaults.
(You can always override them by editing your .gmtdefaults file)
==> Do you prefer inches or centimeters as default unit (i/c) [i]: c
Creating Makefile Macros (originals saved in makegmt.macros.orig)
Choose among the following settings for CC_OPT, or enter 0
to specify your own custom CC_OPT
-------------------------------------------------------------------------
1: CC_OPT = -O # Generic
2: CC_OPT = -ieee_with_inexact -Olimit 1500 # Dec Alpha OSF
3: CC_OPT = -O -Olimit 1500 # Dec VMS Ultrix
4: CC_OPT = -mieee -O2 # Dec Alpha/Alpha PC Linux
5: CC_OPT = -Aa +Ofltacc # HPUX
6: CC_OPT = -Daux -O # A/UX
7: CC_OPT = -O -ansi -pedantic # Gnu gcc compiler
8: CC_OPT = -O -ansi -D_WIN32 # PC Cygwin32 or DJGPP w/ gcc
9: CC_OPT = -O -ansiposix -w # SGI IRIX
10: CC_OPT = -O -Xc # Sun Solaris
11: CC_OPT = -O2 # IBM AIX
-------------------------------------------------------------------------
==> Enter CC_OPT setting number (or 0 to supply a new setting) [1]: 7
Begin GMT installation
・・・・・・・・・・・・(略)・・・・・・・・・・・・
==> Try to run the GMT examples? (y/n) [y]: n
==> Install the supplemental programs? (y/n) [y]: y
==> Install the dbase programs? (y/n) [y]: y
Installing the dbase package. You may need to
edit the makefile to change a few parameters.
==> Hit return to vi makefile:
(何もいじらずviを終了)
==> Install the imgsrc programs? (y/n) [y]: y
Installing the imgsrc package. You may need to
edit the makefile to change a few parameters.
==> Hit return to vi makefile:
(何もいじらずviを終了)
==> Install the meca programs? (y/n) [y]: y
Installing the meca package. You may need to
edit the makefile to change a few parameters.
==> Hit return to vi makefile:
(何もいじらずviを終了)
==> Install the mex programs? (y/n) [y]: n (←Matlab用のプログラムなのでスキップ)
==> Remove the mex directory? (y/n) [n]: n
==> Install the mgg programs? (y/n) [y]: y
Installing the mgg package. You may need to
edit the makefile to change a few parameters.
==> Hit return to vi makefile:
(何もいじらずviを終了)
==> Install the misc programs? (y/n) [y]: y
Installing the misc package. You may need to
edit the makefile to change a few parameters.
==> Hit return to vi makefile:
(何もいじらずviを終了)
==> Install the xgrid programs? (y/n) [y]: n
(↑/usr/openwinの下にあるlibraryやヘッダファイルが要るようだが,/usr/openwinはolwm(Open Look Window Managerが入っていないとできないみたい。Vineにはolmwは入っていないのでcompileできない。RedHat4.2には入っていたのでcompileできていた←その場合,viでMakefileをいじる必要があった。具体的にはSolaris用の行をコメントアウトしてLinux用のコメントを生かす必要があった。)
==> Remove the xgrid directory? (y/n) [n]: n
==> Enter Man page section for GMT man pages (1-9,l) [l]:
==> Enter directory where GMT man pages should be stored [/usr/local/GMT3.1/man/manl]:
Preparing and Installing man pages
All users must include /usr/local/GMT3.1/man in their MANPATH
==> Enter directory where GMT www pages should be stored [/usr/local/GMT3.1/www]:
Preparing and Installing the www pages
All users should add /usr/local/GMT3.1/www/gmt/gmt_services.html to their browser bookmarks
==> Want to print any of the GMT Documentation? (y/n) [y]: n
rm -f blockmean blockmedian blockmode filter1d fitcircle grdfilter gmtconvert gmtdefaults gmtselect gmtset grd2cpt grd2xyz grdcontour grdcut grdclip grdedit grdfft grdgradient grdhisteq grdimage grdinfo grdlandmask grdmask grdtrack grdreformat grdmath grdpaste grdproject grdsample grdtrend grdvector grdview grdvolume makecpt mapproject minmax nearneighbor project psbasemap psclip pscoast pshistogram psimage psmask psrose psscale pstext pscontour pswiggle psxy psxyz sample1d spectrum1d splitxyz surface trend1d trend2d triangulate xyz2grd *.o gmt_nan_init gmthex2ras
GMT installation complete. Remember to set these:
----------------------------------------------------------------
setenv GMTHOME /usr/local/GMT3.1
set path = (/usr/local/GMT3.1/bin $path)
setenv MANPATH /usr/man:/usr/local/man:/usr/X11R6/man:/usr/local/GMT3.1/man:/usr/local/netcdf/man:/usr/local/GMT3.1/man:
Add /usr/local/GMT3.1/www/gmt/gmt_services.html as browser bookmark
----------------------------------------------------------------
[root@sc210]#