GMT-5.4.2をWindows Subsystem for Linux (WSL)のUbuntu 16.04でビルドします.これまでにいくつかの必要なパッケージはインストール済みですが,不足しているパッケージがあれば適宜インストールが必要です.

必要なパッケージのインストール

GMT-5.4.2のBuild InstructionのUbuntu/Debianに従い,以下の通りインストールを進めます.

$ sudo apt update
$ sudo apt install ghostscript
$ sudo apt install subversion build-essential cmake libcurl4-gnutls-dev libnetcdf-dev libgdal1-dev libfftw3-dev libpcre3-dev liblapack-dev
$ sudo apt install graphicsmagick

GMT-5.4.2のビルド

GMT-5.4.2のソースコードとGSHHG,DCWをダウンロードします.これはWindowsでダウンロードすればよいでしょう.Linuxから見たWindowsでのダウンロード先はデフォルトでは以下になります.

/mnt/c/Users/username/Downloads/

~/srcに展開します.~/srcが存在しなければ作っておきます.

$ cd ~/src
$ tar xf /mnt/c/Users/username/Downloads/gmt-5.4.2-src.tar.gz

GSHHGとDCWを適当なディレクトリに解凍します.ここではrootになり,それぞれ/usr/share/gmt-gshhg/および/usr/share/gmt-dcw/に入れておきます.

# sudo su -
# cd /usr/share
# tar xf /mnt/c/Users/username/Downloads/gshhg-gmt-2.3.7.tar.gz
# cd /usr/share
# tar xf /mnt/c/Users/username/Downloads/dcw-gmt-1.1.2.tar.gz
# mv gshhg-gmt-2.3.7 gshhg-gmt
# mv dcw-gmt-1.1.2 dcw-gmt

cmakeの準備をします.

$ cd ~/src/gmt-5.4.2/cmake
$ cp ConfigUserTemplate.cmake ConfigUser.cmake

エディタでConfigUser.cmakeを開き,以下のように設定します.CMAKE_INSTALL_PREFIX等で検索をかけて該当する行を見つけ,コメントを外し,編集します.

set (CMAKE_INSTALL_PREFIX "/usr/local/gmt-5.4.2")
set (GSHHG_ROOT "/usr/share/gmt-gshhg")
set (DCW_ROOT "/usr/share/gmt-dcw")

いよいよcmakeします.cmakeの後はピリオド2つです.make installのみrootで実行します.

$ cd ~/src/gmt-5.4.2
$ mkdir build
$ cd build
$ cmake ..
$ make
# make install

最後に~/.bashrcを編集し,/usr/local/gmt-5.4.2/binにPATHを通します.該当部分の.bashrcは以下のようになります.

export PATH=/usr/local/gmt-5.4.2/bin:$PATH

以上でおわりです.

ビルドエラーの対処法

当初,コンパイルは成功するものの,リンク時に以下のようなエラーとなり,ビルドに失敗しました.

[100%] Linking C executable gmt
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_current_compression@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CTX_free@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_version@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_erase(unsigned long, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `BIO_int_ctrl@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `CRYPTO_get_id_callback@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ASN1_STRING_data@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_NAME_get_entry@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libdapclient.so.6: undefined reference to `std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::logic_error::logic_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ASN1_STRING_length@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CIPHER_get_name@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `sk_num@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFFdOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libkmlbase.so.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(unsigned long, unsigned long, char const*) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `vtable for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `VTT for std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::substr(unsigned long, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstream()@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSLv23_method@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_of(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `BIO_new@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `BIO_set_flags@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `CRYPTO_get_locking_callback@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_NAME_ENTRY_get_data@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `sk_value@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFClose@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_of(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned long, unsigned long)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `vtable for std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libdap.so.17: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libkmldom.so.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libkmlbase.so.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_not_of(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `VTT for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `BIO_s_socket@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ERR_put_error@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_new@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_get_current_cipher@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `BIO_clear_flags@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_not_of(char const*, unsigned long, unsigned long) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_write@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_free@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_free@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libdap.so.17: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpoppler.so.58: undefined reference to `TIFFSetField@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ERR_clear_error@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libicuuc.so.55: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libdap.so.17: undefined reference to `std::logic_error::logic_error(std::logic_error const&)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libdap.so.17: undefined reference to `std::invalid_argument::invalid_argument(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `sqlite3_column_table_name'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CIPHER_get_bits@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libgeos_c.so.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_connect@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_not_of(char, unsigned long) const@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_NAME_get_index_by_NID@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_set_bio@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `sk_free@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_pending@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `X509_get_ext_d2i@OPENSSL_1.0.0'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libpq.so.5: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libgdal.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_not_of(char, unsigned long) const@GLIBCXX_3.4.21'
collect2: error: ld returned 1 exit status
src/CMakeFiles/gmt.dir/build.make:111: recipe for target 'src/gmt' failed
make[2]: *** [src/gmt] Error 1
CMakeFiles/Makefile2:546: recipe for target 'src/CMakeFiles/gmt.dir/all' failed
make[1]: *** [src/CMakeFiles/gmt.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

原因はライブラリ間のバージョンのコンフリクト等にあるようで,先にインストールしていたAnaconda3のライブラリをリンクしようとしていることが問題のようでした.そこで,一時的にAnaconda3がインストールされているディレクトリ名をAnaconda3tmpのように変更し,camkeからAnaconda3が見えないようにしました.このようにしてから,cmakeを実行したところ,問題なくビルドできました.ビルドをやり直すときは作成したbuildディレクトリを削除する必要があります.ビルドに成功したらAnaconda3のディレクトリ名を元に戻しましょう.