macports2.5.3でncarg6.5.0をインストール

気がついたらmacportsの調子が悪くなり、いろいろパッケージが使えなくなったりしてだましだまし使っていたのだが、いろいろとリセット笑させてもらったので、これを機にnclをアップデートしたいと思ったら躓いてしまった。
何とか解決できたので、まとめておく。

###エラー
```:terminal
$ sudo port install ncarg
（中略）
:error:configure Install hdf5 +gcc7
:error:configure Failed to configure ncarg: hdf5 +gcc7 not installed
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/main.log for details.
```
と言われたのでログを見に行くと

```:/opt/local/var/macports/logs/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/main.log
（前略）
:error:configure Install hdf5 +gcc7
:error:configure Failed to configure ncarg: hdf5 +gcc7 not installed
:debug:configure Error code: NONE
:debug:configure Backtrace: hdf5 +gcc7 not installed
:debug:configure     while executing
:debug:configure "$pre $targetname"
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/main.log for details.
```
ほぼ同じことが書いてある。（笑
とりあえずhdf5がgcc7でインストール出来ねえと書いてある。

###ダメだった方法
じゃあncargをインストールする時にoptionをちゃんとつければいいんじゃないかと思ってやってみた。

```:terminal
$ sudo port install ncarg +gcc7
（中略）
:error:configure Install hdf5 +gcc7
:error:configure Failed to configure ncarg: hdf5 +gcc7 not installed
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/main.log for details.
```
変わらない。

```:terminal
$ sudo port install ncarg configure.compiler=macports-gcc-7
（中略）
:error:configure Install hdf5 +gcc7
:error:configure Failed to configure ncarg: hdf5 +gcc7 not installed
:error:configure See /opt/local/var/macports/logs/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/main.log for details.
```
変わらない。
どうやらHDF５を単体でインストールして、gcc7でインストールしたものをactiveにしないといけない？ということで、インストールできた方法に。

###対処法
####1.HDF5をgcc7でインストールする。

```:terminal
$ sudo port install hdf5 +gcc7
--->  Computing dependencies for hdf5
--->  Fetching archive for hdf5
--->  Attempting to fetch hdf5-1.10.2_0+cxx+gcc7+hl.darwin_17.x86_64.tbz2 from https://packages.macports.org/hdf5
--->  Attempting to fetch hdf5-1.10.2_0+cxx+gcc7+hl.darwin_17.x86_64.tbz2 from http://fco.it.packages.macports.org/mirrors/macports-packages/hdf5
--->  Attempting to fetch hdf5-1.10.2_0+cxx+gcc7+hl.darwin_17.x86_64.tbz2 from http://jnb.za.packages.macports.org/packages/hdf5
--->  Fetching distfiles for hdf5
--->  Attempting to fetch hdf5-1.10.2.tar.bz2 from https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.2/src
--->  Verifying checksums for hdf5                                                   
--->  Extracting hdf5
--->  Applying patches to hdf5
--->  Configuring hdf5
Warning: reinplace s|-arch [a-z0-9_]+||g didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_hdf5/hdf5/work/hdf5-1.10.2/tools/src/misc/h5cc
Warning: reinplace s|-arch [a-z0-9_]+||g didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_hdf5/hdf5/work/hdf5-1.10.2/c++/src/h5c++
Warning: reinplace s|-arch [a-z0-9_]+||g didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_hdf5/hdf5/work/hdf5-1.10.2/src/libhdf5.settings
Warning: reinplace s|-arch [a-z0-9_]+||g didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_hdf5/hdf5/work/hdf5-1.10.2/fortran/src/h5fc
Warning: reinplace s|ccache || didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_hdf5/hdf5/work/hdf5-1.10.2/tools/src/misc/h5cc
Warning: reinplace s|ccache || didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_hdf5/hdf5/work/hdf5-1.10.2/c++/src/h5c++
--->  Building hdf5
--->  Staging hdf5 into destroot
--->  Installing hdf5 @1.10.2_0+cxx+gcc7+hl
--->  Deactivating hdf5 @1.10.2_0+cxx+hl
--->  Cleaning hdf5
--->  Activating hdf5 @1.10.2_0+cxx+gcc7+hl
--->  Cleaning hdf5
--->  Scanning binaries for linking errors
--->  No broken files found.
--->  No broken ports found.
--->  Some of the ports you installed have notes:
  hdf5 has the following notes:
    Mac users may need to set the environment variable "HDF5_USE_FILE_LOCKING" to the five-character string "FALSE" when accessing
    network mounted files.  This is an application run-time setting, not a configure or build setting.  Otherwise errors such as "unable
    to open file" or "HDF5 error" may be  encountered.
```
なんだかいろいろwarningが出てきてしまったが

```:terminal
$ port installed
The following ports are currently installed:
（中略）
  hdf5 @1.10.2_0+cxx+hl←もともといれてあったやつ
  hdf5 @1.10.2_0+cxx+gcc7+hl (active)
（後略）
```
hdf5が+gcc7でインストールされてactiveになった。

####2.ncargをgcc7でインストールする。

```:terminal
$ sudo port install ncarg +gcc7
--->  Computing dependencies for ncarg
--->  Configuring ncarg
Warning: reinplace s|g\\+\\+|/opt/local/bin/h5cc| didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/work/ncl_ncarg-6.5.0/ni/src/ncl/yMakefile
Warning: reinplace s| -lquadmath|| didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/work/ncl_ncarg-6.5.0/config/Darwin
Warning: reinplace s|g++$|/usr/bin/clang++| didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/work/ncl_ncarg-6.5.0/config/Darwin
Warning: reinplace s|-D__UNIXOS2__|-D__UNIXOS2__ -D__JIRA1530__| didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/work/ncl_ncarg-6.5.0/config/Darwin
Warning: reinplace s|g++$|/usr/bin/clang++| didn't change anything in /opt/local/var/macports/build/_opt_local_var_macports_sources_www.macports.org_files_ports_science_ncarg/ncarg/work/ncl_ncarg-6.5.0/config/Darwin_Intel
--->  Building ncarg
--->  Staging ncarg into destroot
--->  Installing ncarg @6.5.0_1+accelerate+gcc7
--->  Activating ncarg @6.5.0_1+accelerate+gcc7
--->  Cleaning ncarg
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.
```
お、何とか行った。インストールされているか確認してみると

```:terminal
$ ncl
 Copyright (C) 1995-2018 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.5.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> 
```
インストールできた！（やったー

横着せずにパッケージ一つずつ、optionつけてインストールするのが時に大事だということが分かりました。