Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
melody.zhu@mahuika02 ~/gmt> mkdir build
melody.zhu@mahuika02 ~/gmt> cd build
melody.zhu@mahuika02 ~/gmt/build> cmake ..
Error: cannot find CURL_INCLUDE_DIR error
Solution: check if you install your custom curl
          edit ccmake..
Code Block
 melody.zhu@mahuika02 ~/gmt/build> ccmake .. 
 # hardcode the path for following variables. Enforce using custom curl and zlib. Editing ConfigUser.cmake will not solve the issue.
 CURL_INCLUDE_DIR                 /home/melody.zhu/bin/curl/include                                                                                                                                                                          
 CURL_LIBRARY                     /home/melody.zhu/bin/curl/lib/libcurl.so
 
 ZLIB_INCLUDE_DIR                 /home/melody.zhu/bin/zlib/include                                                                                                                                                                          
 ZLIB_LIBRARY                     /home/melody.zhu/bin/zlib/lib/libz.so         

 

Error: '/cm/shared/apps/intel/compilers_and_libraries/2017.6.256/linux/mkl/lib/intel64/libmkl_gf_lp64.so: error: undefined reference to 'mkl_lapack_*'

Solution: Remove mkl module

Code Block
melody.zhu@mahuika02 ~/gmt/build> module rm imkl/2017.6.256-gimpi-2017a

 

Error: 

/opt/nesi/mahuika/binutils/2.28-GCCcore-7.1.0/bin/ld: warning: libopenjp2.so.7, needed by /opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/opt/nesi/mahuika/binutils/2.28-GCCcore-7.1.0/bin/ld: warning: libpq.so.5, needed by /opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/opt/nesi/mahuika/binutils/2.28-GCCcore-7.1.0/bin/ld: warning: libkea.so.1.4.6, needed by /opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/lib/libgdal.so: undefined reference to `kealib::KEAImageIO::setImageBandClrInterp(unsigned int, kealib::KEABandClrInterp)'
/opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/lib/libgdal.so: undefined reference to `PQputCopyEnd'
/opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/lib/libgdal.so: undefined reference to `opj_create_compress'

Solution: 

Check modules:OpenJPEG/2.3.0-gimkl-2017a, KEALib/1.4.6-gimkl-2017a and PostgreSQL/9.6.2-gimkl-2017a are loaded.
Check the above modules are in PATH; Their libs are in LD_LIBRARY_PATH

Code Block
melody.zhu@mahuika02 /scale_wlg_persistent/filesets/project/nesi00213/share> module show KEALib/1.4.6-gimkl-2017a
prepend_path("LD_LIBRARY_PATH","/opt/nesi/mahuika/KEALib/1.4.6-gimkl-2017a/lib")
prepend_path("LIBRARY_PATH","/opt/nesi/mahuika/KEALib/1.4.6-gimkl-2017a/lib")
prepend_path("PATH","/opt/nesi/mahuika/KEALib/1.4.6-gimkl-2017a/bin")

# Add missing libs to LD_LIBRARY_PATH: (use 'module show' to see each module path)
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nesi/mahuika/PostgreSQL/9.6.2-gimkl-2017a/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nesi/mahuika/OpenJPEG/2.3.0-gimkl-2017a/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nesi/mahuika/KEALib/1.4.6-gimkl-2017a/lib

 

Error: Linking C executable gmt /opt/nesi/mahuika/libpng/1.6.28-gimkl-2017a/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9

Solution: check if you install your custom libpng using your custom zlib (see point 3)

                check if you have the correct ZLIB_INCLUDE_DIR and ZLIB_LIBRARY in ccmake
                check src/CMakeFiles/gmt.dir/link.txt and edit so cmake can find libs for your custom curl and zlib

Code Block
melody.zhu@mahuika02 ~/gmt/build> vim src/CMakeFiles/gmt.dir/link.txt
/usr/bin/cc  -std=gnu99  -ggdb3 -O2 -Wuninitialized    CMakeFiles/gmt.dir/gmt.c.o  -o gmt -rdynamic libgmt.so.6.0.0 /cm/shared/apps/netcdf/gcc/64/4.4.0/lib/libnetcdf.so /home/melody.zhu/bin/curl/lib/libcurl.so -lgdal -lpcre -lfftw3f -lfftw3f_threads -lblas libpostscriptlight.so.6.0.0 /home/melody.zhu/bin/zlib/lib/libz.so -lm -ldl -Wl,-rpath,/home/melody.zhu/gmt/build/src:/cm/shared/apps/netcdf/gcc/64/4.4.0/lib:/home/melody.zhu/bin/curl/lib:/home/melody.zhu/bin/zlib/lib

  

When no error running cmake ..

Do

Code Block
melody.zhu@mahuika02 ~/gmt/build> cmake ..
melody.zhu@mahuika02 ~/gmt/build> make
melody.zhu@mahuika02 ~/gmt/build> make install DESTDIR=/home/melody.zhu/bin

 GMT will be installed to /home/melody.zhu/bin/usr/local/bin

 

Now add GMT to PATH and LD_LIBRARY_PATH 

Code Block
melody.zhu@mahuika02 ~/gmt> PATH=$PATH:/home/melody.zhu/bin/usr/local/bin
melody.zhu@mahuika02 ~/gmt> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/melody.zhu/bin/usr/local/lib64

 

(3) Test

Code Block
melody.zhu@mahuika02 ~> gmt
GMT - The Generic Mapping Tools, Version 6.0.0_a7d5353-dirty [64-bit] [72 cores]
(c) 1991-2018 Paul Wessel, Walter H. F. Smith, Remko Scharroo, Joaquim Luis, and Florian Wobbe
Supported in part by the US National Science Foundation (http://www.nsf.gov/)
and volunteers from around the world (see http://gmt.soest.hawaii.edu/).
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of the
GNU Lesser General Public License (http://www.gnu.org/licenses/lgpl.html).
For more information about legal matters, see the file named LICENSE.TXT.
usage: gmt [options]
       gmt <module name> [<module-options>]
session management:
  gmt begin         Initiate a new GMT session using modern mode [classic].
  gmt end           Terminate the current GMT modern mode session.
  gmt docs          Display the HTML documentation for selected module.
  gmt figure        Set figure format specifics under a GMT modern mode session.
  gmt subplot       Initiate a multi-panel figure.
  gmt clear all | cache | cpt | conf | data | history | sessions
                    Delete gmt.history, gmt.conf, session CPT, the user cache or data dir, or all of them.
options:
  --help            List descriptions of available GMT modules.
  --show-bindir     Show directory with GMT executables.
  --show-cores      Print number of available cores.
  --show-datadir    Show directory/ies with user data.
  --show-modules    List all module names.
  --show-library    Show path of the shared GMT library.
  --show-plugindir  Show directory for plug-ins.
  --show-sharedir   Show directory for shared GMT resources.
  --version         Print GMT version number.
if <module-options> is '=' we call exit (0) if module exist and non-zero otherwise.

 

Sample PATHs that will correctly compile GMT      

Code Block
PATH=/opt/nesi/mahuika/GCCcore/7.1.0/bin:/opt/nesi/mahuika/GEOS/3.6.1-gimkl-2017a/bin:/opt/nesi/mahuika/GDAL/2.2.2-gimkl-2017a-GEOS-3.5.1/bin:/opt/gcc/4.9.1/bin:/opt/slurm/17.11.7/sbin:/opt/slurm/17.11.7/bin:/opt/nesi/mahuika/libreadline/6.3-gimkl-2017a/bin:/opt/nesi/mahuika/libpng/1.6.28-gimkl-2017a/bin:/cm/shared/apps/netcdf/gcc/64/4.4.0/bin:/opt/nesi/mahuika/HDF5/1.8.18-gimkl-2017a/bin:/opt/nesi/mahuika/HDF/4.2.13-gimkl-2017a/bin:/opt/nesi/mahuika/PROJ/4.9.3-gimkl-2017a/bin:/opt/nesi/mahuika/FFTW/3.3.5-gimkl-2017a/bin:/opt/nesi/mahuika/binutils/2.28-GCCcore-7.1.0/bin:/opt/nesi/mahuika/Python/2.7.14-gimkl-2017a/bin:/opt/nesi/mahuika/Tk/8.6.6-gimkl-2017a/bin:/opt/nesi/mahuika/Tcl/8.6.6-gimkl-2017a/bin:/opt/nesi/mahuika/SuiteSparse/4.5.4-gimkl-2017a/bin:/opt/nesi/mahuika/METIS/5.1.0-gimkl-2017a/bin:/opt/nesi/mahuika/netCDF/4.4.1-gimkl-2017a/bin:/opt/nesi/mahuika/cURL/7.52.1-gimkl-2017a/bin:/opt/nesi/mahuika/LLVM/4.0.0-gimkl-2017a/bin:/opt/nesi/mahuika/libxslt/1.1.29-gimkl-2017a/bin:/opt/nesi/mahuika/freetype/2.7.1-gimkl-2017a/bin:/opt/nesi/mahuika/bzip2/1.0.6-gimkl-2017a/bin:/opt/nesi/mahuika/PostgreSQL/9.6.2-gimkl-2017a/bin:/opt/nesi/mahuika/PCRE/8.40-gimkl-2017a/bin:/opt/nesi/mahuika/libxml2/2.9.4-gimkl-2017a/bin:/opt/nesi/mahuika/XZ/5.2.3-gimkl-2017a/bin:/opt/nesi/mahuika/SQLite/3.16.2-gimkl-2017a/bin:/opt/nesi/mahuika/ncurses/6.0-gimkl-2017a/bin:/opt/nesi/mahuika/libgeotiff/1.4.2-gimkl-2017a/bin:/opt/nesi/mahuika/LibTIFF/4.0.7-gimkl-2017a/bin:/opt/nesi/mahuika/KEALib/1.4.6-gimkl-2017a/bin:/opt/nesi/mahuika/OpenJPEG/2.3.0-gimkl-2017a/bin:/opt/nesi/mahuika/libjpeg-turbo/1.5.1-gimkl-2017a/bin:/opt/nesi/mahuika/expat/2.2.0-gimkl-2017a/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin:/opt/nesi/bin:/home/melody.zhu/bin:/home/melody.zhu/bin/usr/local/bin:/scale_wlg_persistent/filesets/project/nesi00213/opt/mahuika:/opt/nesi/mahuika/KEALib/1.4.6-gimkl-2017a/bin:/scale_wlg_persistent/filesets/project/nesi00213/opt/mahuika/gmt/6.0.0/usr/local/bin

...