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>gmt/build> cmake ..
 
# if you get 'cannot find CURL_INCLUDE_DIR error'
# first check if you install your custom curl
# second edit ccmake ..

melody.zhu@mahuika02 ~/gmt>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         
 
# if you get '/cm/shared/apps/intel/compilers_and_libraries/2017.6.256/linux/mkl/lib/intel64/libmkl_gf_lp64.so: error: undefined reference to 'mkl_lapack_*'
# Remove mkl module use
melody.zhu@mahuika02 ~/gmt>gmt/build> module rm module rm imkl/2017.6.256-gimpi-2017a


# if you get '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'
# first check if you install your custom libpng using your custom zlib (see point 3)
# Second check if you have the correct ZLIB_INCLUDE_DIR and ZLIB_LIBRARY in ccmake
# Third check src/CMakeFiles/gmt.dir/link.txt and edit so cmake can find libs for your custom curl and zlib
 
melody.zhu@mahuika02 ~/gmt/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 ..
melody.zhu@mahuika02 ~/gmt>gmt/build> cmake ..
melody.zhu@mahuika02 ~/gmt>gmt/build> make
melody.zhu@mahuika02 ~/gmt/gmt>build> make install DESTDIR=/home/melody.zhu/bin
 
# GMT will be installed to /home/melody.zhu/bin/usr/local/bin
# test GMT
melody.zhu@mahuika02 ~> gmt
# if you get 'gmt: error while loading shared libraries: libgmt.so.6: cannot open shared object file: No such file or directory
# update PATH and LD_LIBRARY_PATH 
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

# else: 
 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.



...