Installing the Generic Mapping Tools 5 (GMT 5.1.x) on Ubuntu Linux

The Generic Mapping Tools (GMT) are a suite of tools for making maps. The graphics generated with default settings in GMT exceed in many ways those which would come out of most users’ ArcGIS work. Admittedly, GMT does come with a steep learning curve, not excluding the installation process. For earlier versions of GMT (4.x.x) installation is more simple and direct, as you can just install from the Ubuntu Software Center (or other package managers), however, these managers typically don’t have the most recent versions — in this case GMT version 5.1.x.

Without further adieu, in the following steps, we will collect the necessary components of the GMT install, compile, and install. Most of the guide comes from the GMT website, but is supplemented with some of what I think are helpful details for new users to GMT.

READ: This guide uses the terminal and a file explorer, but the entire install can be done from the terminal; in some steps incomplete commands to do operations via terminal are listed in square brackets […] where items in carrot brackets must be replaced with system/your-install specific items <…>. All terminal commands listed without brackets are required for successful install.

1) Begin by installing several dependency packages. Running the following command will be sufficient, as any already installed packages will be skipped.
sudo apt-get install subversion ghostscript build-essential cmake libnetcdf-dev libgdal1-dev libfftw3-dev libpcre3-dev

2) Download the latest stable version of GMT using
svn checkout svn://gmtserver.soest.hawaii.edu/gmt5/trunk gmt5-dev

3) Visit the GMT download page and download the latest versions of the packages titled “gshhg-gmt-x.x.x.tar.gz” and “dcw-gmt-x.x.x.tar.gz”.
[wget http://gmt.soest.hawaii.edu/files/download?name=dcw-gmt-x.x.x.tar.gz]

4) Copy each compressed folder into the directory downloaded via subversion — this should be located at ~/gmt5-dev by default. Uncompress the folders here.
[cd ~/gmt5-dev]
[cp ./ && cp ./]
[tar -zxvf gshhg-gmt-x.x.x.tar.gz]

5) In the ~/gmt5-dev folder, enter the cmake folder, make a copy of the ConfigUserTemplate.cmake file and rename the copy to ConfigUser.cmake. Open this file in an editor.
[cp ConfigUserTemplate.cmake ./ConfigUser.cmake]
[gedit ConfigUser.cmake]

6) You need to edit the following lines of this file:
a. enable (uncomment) line 107 (set (GSHHG_ROOT…) and replace the path name with the absolute path to the gshhg-gmt-x.x.x folder.
b. enable copy in line 110
c. enable line 113 and replace the path nae with the absolute path to the dcw-gmt-x.x.x folder.
d. enable copy in line 116
Save the file and return to the terminal. NOTE: the line numbers may change with updates by the GMT devs to the .cmake file. Thanks @jerrodwalker for the most recent file lines.

7) cd into the ~/gmt5-dev folder and execute the following commands, waiting to finish each time.
mkdir build
cd build
cmake ..
make
sudo make install

That should complete your install of GMT 5.1.x! To test the install, try the following command into a new terminal window
gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps

Check out the first article of my series on making maps with GMT here!

UPDATE: These instructions were tested on 08/25/16 on Ubuntu 16.04 LTS and remain successful when followed correctly (thanks Luis M.).

61 thoughts on “Installing the Generic Mapping Tools 5 (GMT 5.1.x) on Ubuntu Linux

  1. febty

    Thanks very much for your tutorial. I followed your tutorial. However, after trying the following command ; gmt psbasemap -R90/180/-50/50 -Jm0.025i -B30g30:.Mercator: -Lx1i/1i/0/5000 > mercator.ps, as you suggested, I found the error message:

    Sub-commands for gmt:
    install install more modules
    ERROR: Please specify valid params for ‘gmt’.

    Do you have suggestion for my case? Thanks very much in advance.

    Reply
    1. Andrew Moodie Post author

      Did you follow the tutorial, or did you try and install with sudo apt-get install gmt because, the latter will install the Genome Modeling Tools, which seems to generate the error you describe. You will need to do sudo apt-get remove gmt and then return to the top of the tutorial and follow again. I have tried the tutorial twice on fresh Ubuntu 14.04 installs and had no trouble. Good luck!

      Reply
    1. ashim

      I followed this tutorial. But got the same problem (above mentioned) when I tried the following command
      ashim@ashim-Joybook-Lite-U102:~$ gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps
      Sub-commands for gmt:
      install install more modules
      ERROR: Please specify valid params for ‘gmt’.

      Reply
  2. Bramha

    Hello Andrew,

    Thank a lot for such a wonderful blog.

    I am a beginner with linux and GMT. I followed the procedure mentioned by you. But at the end when I test the gmt. I get the following error:
    gmt: warning: PS_IMAGE_COMPRESS = DEFLATE not available, falling back to LZW.
    pscoast: Syntax error: Must specify a map projection with the -J option

    Can you please help me with this error.

    Thanks a lot.

    Reply
    1. Andrew Moodie Post author

      Bramha, this is odd. It seems like you are getting an error because the compression scheme selected is failing. This, however, shouldn’t be an issue because it has a default that it should use. Try running: gmt gmtset PS_IMAGE_COMPRESS lzw (alternatively gmt gmtset PS_IMAGE_COMPRESS none) and then rerun the “test” command.

      The second error “pscoast: Syntax error: Must specify a map projection with the -J option” really bewilders me because the -J switch is explicitly listed in the command! What happens if you just type gmt pscoast?

      Reply
      1. Bramha

        Hello Andrew,
        I tried running: gmt gmtset PS_IMAGE_COMPRESS lzw (alternatively gmt gmtset PS_IMAGE_COMPRESS none) and then returned the “test” command. Still i got-

        gmt: warning: PS_IMAGE_COMPRESS = DEFLATE not available, falling back to LZW.

        Do i need to install apache mod_deflate ?

        Then I run gmt pscoast and i get following……
        gmt: warning: PS_IMAGE_COMPRESS = DEFLATE not available, falling back to LZW.
        pscoast(core) 5.1.2_r14127 [64-bit] – Plot continents, countries, shorelines, rivers, and borders on maps

        usage: pscoast -B -J [-A[//][+as][+r|l][+p]]
        [-R///[//][r]] [-C[/]]….. and so on.. telling about how to use pscoast.

        Thanks a lot, being a beginner your help is highly valuable for me 🙂 .

        I get a mercator.ps which is the map, but upside down.
        What do you think is the problem now?

        Have a nice day ahead.

        Reply
        1. Andrew Moodie Post author

          Bramha, you ran only the command parts of that line, not the entire line, correct? In essence only run ” gmt gmtset PS_IMAGE_COMPRESS none” without the quotes. This should disable the compression, and stop throwing the error message.

          If the map works, the upside down problem is only a problem with the viewer not loading it correctly. I’m thinking you may be using the default “Document Viewer” in Ubuntu? Click on the image and press CRTL+LEFTARROW twice to make it upright. Alternatively, install and use another PostScript viewer, all other programs I’ve used render it fine.

          Reply
  3. brahim

    Hello
    i get this message
    aaa@ubuntu:~/src/gmt-5.1.1$ sudo gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps
    pscoast: GSHHG version 2.2.0 or newer is needed to use coastlines with GMT.
    Get and install GSHHG from ftp://ftp.soest.hawaii.edu/pwessel/gshhg/.
    pscoast: intermediate resolution shoreline data base not installed
    pscoast: No databases available – aborts
    thank’s

    Reply
    1. Andrew Moodie Post author

      Your GSHHG coastlines database didn’t install, or you didn’t locate it correctly (step 6 of install). Make sure you have done both correctly, and try the install again (all steps).

      You can change the directory you specified as the location of the GSHHG database during install by editing the DIR_GSHHG line of the gmt.conf file [ gedit gmt.conf].

      Reply
      1. Taichengmong Rajkumar

        Hello Sir,
        I am having the same problem as brahim. I am bigginer of GMT tool. As you mentioned in Step 6 of install i edited the ConfigUser.cmake file as shown below. is there any mistake in making the correction of path ? Please help

        # Set path to GSHHG Shoreline Database [TRUE]:
        #set (GSHHG_ROOT “/home/taicheng/Downloads/gshhg-gmt-2.3.4”)

        # Copy GSHHG files to $/coast [TRUE]:
        #set (COPY_GSHHG TRUE)

        # Set path to DCW Digital Chart of the World for GMT [auto]:
        #set (DCW_ROOT “/home/taicheng/Downloads/dcw-gmt-1.1.1”)

        # Copy DCW files to $/dcw [TRUE]:
        #set (COPY_DCW TRUE)

        Reply
        1. Andrew Moodie Post author

          No that file looks fine. I may have to try a fresh install to see if these instructions are still valid, the were written almost 6 months ago now…The only suggestion I have is to be sure the folder exists at the path you specified and to try the install again. I’ll try and retest the instructions asap.

          Reply
  4. Xiao-Qiang Yang

    It showed the following error message:
    CMake Error at share/conf/cmake_install.cmake:36 (FILE):
    file INSTALL cannot find
    “/home/xiaoqiangyang/gmt5-dev]/build/share/conf/gmt.conf;/home/xiaoqiangyang/gmt5-dev]/build/share/conf/gmt_US.conf;/home/xiaoqiangyang/gmt5-dev]/build/share/conf/gmt_SI.conf”.
    Call Stack (most recent call first):
    share/cmake_install.cmake:64 (INCLUDE)
    cmake_install.cmake:38 (INCLUDE)

    Reply
    1. Andrew Moodie Post author

      You need to be in the correct subdirectory for CMake to find the files, did you follow along exactly, including the cd commands?

      Reply
  5. prasad

    Hello Andrew,

    How can I uninstall/remove gmt 5.1.0. ? I have tried with the command ” sudo apt-get remove gmt “. But It did not work.
    Thanks !!

    Reply
    1. Andrew Moodie Post author

      Because this isn’t a package-manager managed package, that command will not work. If you are really set on uninstalling (it’s a fairly small and excellent package, not sure why you want to), you need to go through your system and remove the folders that house GMT. They should be reasonably easy to locate.

      Reply
  6. krishna

    Hello Andrew,

    Please help me, I’m getting the following error in the 7th step after entering ‘make’ command

    “krishna@krishna-VPCEH2BGN:~/software/gmt5-dev/cmake$ make
    [ 3%] Built target gen_gmt_headers
    Linking C shared library libpsl.so
    /home/krishna/software/lib/libz.so: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    make[2]: *** [src/libpsl.so.5.1.2] Error 1
    make[1]: *** [src/CMakeFiles/pslib.dir/all] Error 2
    make: *** [all] Error 2
    krishna@krishna-VPCEH2BGN:~/software/gmt5-dev/cmake$”

    Thanks in advance ,

    Reply
    1. Andrew Moodie Post author

      Hmm. Sometimes make fails when you have mixed 32-bit or 64-bit libraries. Try from the beginning again, and make sure you install all dependencies along the way.

      Reply
  7. amit singh

    Dear sir,
    I am new with Linux system and GMT installation. I wan to share to one GMT installation way. I will paste steps below. i got these steps from internet from somewhere. But i am unable to install GMT.
    Could you suggest which methods i should follow 1) Your’s given methods 2) I got from internet.

    Please Suggest me what to do? I have not tried yours method. because i could not uninstall earlier pakages during GMT 4.x.

    Guide me how to go about it.

    *************************************
    Steps to install GMT 4.x:
    %%% installing R %%%%%
    sudo apt-get update
    sudo apt-get install r-base
    %%%% installing cdo %%%%%
    sudo apt-get install cdo
    %%% install nco %%%
    sudo apt-get install nco
    %% install ncview %%%%
    sudo apt-get ncview
    %%% install netcdf 4, HDF 5, and
    Download netcdf-4.1.3.tar.gz from http://www.unidata.ucar.edu/downloads/netcdf/netcdf-4_1_3/index.jsp
    Download hdf5-1.8.6.tar.gz from ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/
    Download zlib-1.2.5.tar.gz from ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/
    Copy downloaded files to /usr/local/bin
    Extract them using
    gunzip *.gz
    tar – xvf netcdf-4.1.3.tar
    tar – xvf hdf5-1.8.6.tar
    tar – xvf zlib-1.2.5.tar
    now go to the zlib folder
    cd zlib-1.2.5
    Run following commands
    ./configure –prefix=/usr/local/bin
    make chekc install
    now go to the HDF5 folder
    cd hdf5-1.8.6
    Run the following commands
    ./configure –with-zlib=/usr/local/bin –prefix=/usr/local/bin
    make check install
    Now go to the netcdf folder
    cd netcdf-4.1.3
    Run the following commands
    CPPFLAGS=-I/usr/local/bin/include LDFLAGS=-L/usr/local/bin/lib ./configure –prefix=/usr/local/bin
    make check install
    %%% install hdf5 %%%
    sudo apt-get install hdf5-tools
    %%% install GMT %%%%%
    See the instructions at :
    http://www.mbari.org/data/mbsystem/installubuntu/index.html
    ****************************************************************************************************************************************
    with regards-
    Amit

    Reply
    1. Andrew Moodie Post author

      Try my method, if it doesn’t work, there is really no harm done. The other set of instructions seems to be installing some superfluous packages and in a roundabout way.

      Reply
  8. mahdy

    Dear sir
    Please help me, I’m getting the following error in the 7th step after entering cmake .. command
    — Configuring incomplete, errors occurred!
    See also “/home/azizi/Pictures/gmt-5.1.2/build/CMakeFiles/CMakeOutput.log”.
    Thanks !!

    Reply
  9. michael

    Thanks for doing this!

    I am getting two problems:

    IN step 4 when you have us enter:
    cp ./ && cp ./

    I get: “cp: missing destination file operand after ‘./’ ”

    Also: last step, when I enter:
    cmake ..

    I get:
    CMake Error: The source directory “/home/mike/gmt5-dev/cmake” does not appear to contain CMakeLists.txt.

    from here I can’t really press on. Any pointers?

    Thanks so much!

    Reply
    1. Andrew Moodie Post author

      The cp command is not a complete command, you need to complete the command with the absolute source and directory, see man cp . If you are a novice to linux, I recommend you use the file explorer in your OS to copy the files from one location to another. If you set up the CMakeConfig file as described, you should not get this error.

      Reply
      1. michael

        Thanks, it worked this time however, I am getting the same error as other users saying that gshhg isn’t installed. It appears that when I do the cmake .. command it doesn’t locate the gshhg file. And gmt.conf (located in home/gmt5-dev/build/share/conf/) confirms that it doesn’t know where it is.

        Here is how my ConfigUser.cmake (located in home/gmt5-dev/cmake) file looks like where the changes where made:

        # Set path to GSHHG Shoreline Database [auto]:
        set (GSHHG_ROOT “/home/gmt5-dev/gshhg-gmt-2.3.4”)

        # Copy GSHHG files to $/coast [FALSE]:
        set (COPY_GSHHG TRUE)

        # Set path to DCW Digital Chart of the World for GMT [auto]:
        set (DCW_ROOT “/home/gmt5-dev/dcw-gmt-1.1.1”)

        # Copy DCW files to $/dcw [FALSE]:
        set (COPY_DCW TRUE)

        I can assure you the file locations are where they say they are (home/gmt5-dev/)

        Any ideas?

        Thanks so much for your help.

        Reply
        1. Andrew Moodie Post author

          are you sure it is not “/home/michael/gmt5-dev/gshhg-gmt-2.3.4” where /michael is the username you set up on your computer? You can verify this by navigating to the GSHHG file using cd to change directories in the terminal and ls -la to see available folders and files. Once you are in the folder with the GSHHG file type pwd to “print working directory” and see where the file is truly located. I suspect it will be “/home/michael/gmt5-dev/gshhg-gmt-2.3.4”.

          Reply
  10. sermet

    I’m getting the following error while entering cmake .. command in build directory;
    CMake Error at cmake/modules/FindNETCDF.cmake:127 (message):
    Library found but netCDF-4/HDF5 format unsupported. Do not configure
    netCDF-4 with –disable-netcdf-4.

    CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
    Could NOT find NETCDF (missing: HAVE_NETCDF4)

    — Configuring incomplete, errors occurred!
    See also “/home/asus/gmt5-dev/build/CMakeFiles/CMakeOutput.log”.
    See also “/home/asus/gmt5-dev/build/CMakeFiles/CMakeError.log”.

    in CMakeError.log file;

    Determining if the nc_def_var_deflate exist failed with the following output:
    Change Dir: /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp

    Run Build Command:/usr/bin/make “cmTryCompileExec1605615427/fast”
    /usr/bin/make -f CMakeFiles/cmTryCompileExec1605615427.dir/build.make CMakeFiles/cmTryCompileExec1605615427.dir/build
    make[1]: Entering directory `/home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp’
    /usr/bin/cmake -E cmake_progress_report /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp/CMakeFiles 1
    Building C object CMakeFiles/cmTryCompileExec1605615427.dir/CheckSymbolExists.c.o
    /usr/bin/cc -std=gnu99 -I/usr/local/netcdf/include -o CMakeFiles/cmTryCompileExec1605615427.dir/CheckSymbolExists.c.o -c /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
    Linking C executable cmTryCompileExec1605615427
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1605615427.dir/link.txt –verbose=1
    /usr/bin/cc -std=gnu99 CMakeFiles/cmTryCompileExec1605615427.dir/CheckSymbolExists.c.o -o cmTryCompileExec1605615427 -rdynamic /usr/local/netcdf/lib/libnetcdf.so -Wl,-rpath,/usr/local/netcdf/lib
    CMakeFiles/cmTryCompileExec1605615427.dir/CheckSymbolExists.c.o: In function `main’:
    CheckSymbolExists.c:(.text+0x16): undefined reference to `nc_def_var_deflate’
    collect2: error: ld returned 1 exit status
    make[1]: *** [cmTryCompileExec1605615427] Error 1
    make[1]: Leaving directory `/home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp’
    make: *** [cmTryCompileExec1605615427/fast] Error 2

    File /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
    /* */
    #include

    int main(int argc, char** argv)
    {
    (void)argv;
    #ifndef nc_def_var_deflate
    return ((int*)(&nc_def_var_deflate))[argc];
    #else
    (void)argc;
    return 0;
    #endif
    }

    Determining if the nc_def_var_deflate exist failed with the following output:
    Change Dir: /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp

    Run Build Command:/usr/bin/make “cmTryCompileExec3769192476/fast”
    /usr/bin/make -f CMakeFiles/cmTryCompileExec3769192476.dir/build.make CMakeFiles/cmTryCompileExec3769192476.dir/build
    make[1]: Entering directory `/home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp’
    /usr/bin/cmake -E cmake_progress_report /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp/CMakeFiles 1
    Building C object CMakeFiles/cmTryCompileExec3769192476.dir/CheckSymbolExists.c.o
    /usr/bin/cc -std=gnu99 -I/usr/local/netcdf/include -o CMakeFiles/cmTryCompileExec3769192476.dir/CheckSymbolExists.c.o -c /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
    Linking C executable cmTryCompileExec3769192476
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3769192476.dir/link.txt –verbose=1
    /usr/bin/cc -std=gnu99 CMakeFiles/cmTryCompileExec3769192476.dir/CheckSymbolExists.c.o -o cmTryCompileExec3769192476 -rdynamic /usr/local/netcdf/lib/libnetcdf.so -Wl,-rpath,/usr/local/netcdf/lib
    CMakeFiles/cmTryCompileExec3769192476.dir/CheckSymbolExists.c.o: In function `main’:
    CheckSymbolExists.c:(.text+0x16): undefined reference to `nc_def_var_deflate’
    collect2: error: ld returned 1 exit status
    make[1]: Leaving directory `/home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp’
    make[1]: *** [cmTryCompileExec3769192476] Error 1
    make: *** [cmTryCompileExec3769192476/fast] Error 2

    File /home/asus/gmt5-dev/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:

    Reply
    1. sermet

      I realized that I installed netcdf with — disable netcdf4, it solved the problem. I completed the install but when I execute “gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps” to check out the installation I got;
      pscoast: GSHHG version 2.2.0 or newer is needed to use coastlines with GMT.
      Get and install GSHHG from ftp://ftp.soest.hawaii.edu/gshhg/.
      pscoast: Could not find file [GSHHG intermediate resolution shorelines]
      pscoast: No GSHHG databases available – must abort

      Reply
  11. John

    Hi
    i was wondering if you’d have any advice on some trouble im having installing this.
    followed the guide excatly (i think) still getting this message when try to test
    pscoast: GSHHG version 2.2.0 or newer is needed to use coastlines with GMT.
    Get and install GSHHG from ftp://ftp.soest.hawaii.edu/pwessel/gshhg/.
    pscoast: intermediate resolution shoreline data base not installed
    pscoast: No databases available – aborts

    i think my config file is correct
    # Set path to GSHHG Shoreline Database [auto]:
    set (GSHHG_ROOT “/home/john/gmt5-dev/gshhg-gmt-2.3.4”)

    # Copy GSHHG files to $/coast [FALSE]:
    set (COPY_GSHHG TRUE)

    # Set path to DCW Digital Chart of the World for GMT [auto]:
    set (DCW_ROOT “/home/john/gmt5-dev/dcw-gmt-1.1.1”)

    # Copy DCW files to $/dcw [FALSE]:
    set (COPY_DCW TRUE)

    typing gmt pscoast gives a long list of options to do with gmt
    Im very new to this so it could be something quite stupid or obvious but any help you could provide would be greatly apprciated thanks

    Reply
  12. Karen

    Hi Andrew,

    Thanks so much for this page !
    I have a very basic question, due to my very small knowledge of Ubuntu.
    Following your instructions, it seems that my installation of GMT was successful. However, instead of installing GMT in my home folder “~”, I preferred to install it in the following folder: “/usr/local/gmt5-dev/”.

    Now, when I enter the “gmt pscoast …” command line you suggest at the end of your post, the gmt command is indicated as not found.
    It looks to me it is a problem of (un)set path, and I have already added “export PATH=${PATH}:/usr/local/gmt5-dev/” in my .bashrc file, but the gmt command is still not found. What am I missing ??

    Thanks a lot for your help,

    Karen.

    Reply
  13. Karen

    Hi Andrew,

    Please delete my previous question, I have tried to reinstall GMT, just in case, and now everything works properly. Apologies for wasting your time and thanks again for this post !

    Karen.

    Reply
  14. hammou

    pleas help
    CMake Error: Error in cmake code at
    /home/gph_pt/Bureau/gmt5-dev/cmake/ConfigUser.cmake:99:
    Parse error. Expected “(“, got identifier with text “path”.
    CMake Error at cmake/modules/ConfigCMake.cmake:23 (include):
    include could not find load file:

    /home/gph_pt/Bureau/gmt5-dev/cmake/ConfigUser.cmake
    Call Stack (most recent call first):
    CMakeLists.txt:75 (include)

    Reply
    1. Andrew Moodie Post author

      It looks like you have not properly set the paths to the GSHHG files. Line 99 (or perhaps 100) should read something like: set (GSHHG_ROOT "/home/andrew/gmt5-dev/gshhg-gmt-2.3.4")

      Reply
  15. Sara

    Hi Andrew,

    First at all, thank you so much for this great post! I new in Linux and GMT,….I have problems when I test the install, trying the following command into a new terminal window:

    sara@saratron:~$ gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps
    pscoast: GSHHG version 2.2.0 or newer is needed to use coastlines with GMT.
    Get and install GSHHG from ftp://ftp.soest.hawaii.edu/gshhg/.
    pscoast: Could not find file [GSHHG intermediate resolution shorelines]
    pscoast: No GSHHG databases available – must abort

    ¿No GSHHG databases available?
    Inside the gshhg-gmt-2.3.5 folder there are:

    sara@saratron:~/gmt5-dev/gshhg-gmt-2.3.5$ ls
    binned_border_c.nc binned_GSHHS_f.nc binned_river_h.nc LICENSE.TXT
    binned_border_f.nc binned_GSHHS_h.nc binned_river_i.nc mercator.ps
    binned_border_h.nc binned_GSHHS_i.nc binned_river_l.nc README.TXT
    binned_border_i.nc binned_GSHHS_l.nc COPYING.LESSERv3
    binned_border_l.nc binned_river_c.nc COPYINGv3
    binned_GSHHS_c.nc binned_river_f.nc gmt.history

    in /home/sara, I have this files:
    Descargas gmt5-dev map.ps
    Documentos gmt.history mercator.ps
    Escritorio

    But I can’t open the files .ps .

    In sara@saratron:~/gmt5-dev/gshhg-gmt-2.3.5$, there are this another files :
    binned_border_c.nc binned_GSHHS_f.nc binned_river_h.nc LICENSE.TXT
    binned_border_f.nc binned_GSHHS_h.nc binned_river_i.nc mercator.ps
    binned_border_h.nc binned_GSHHS_i.nc binned_river_l.nc README.TXT
    binned_border_i.nc binned_GSHHS_l.nc COPYING.LESSERv3
    binned_border_l.nc binned_river_c.nc COPYINGv3
    binned_GSHHS_c.nc binned_river_f.nc gmt.history

    And here I can open the file mercator.ps and I get a map, but rotated 180º….Am I doing things right?

    All comments will be helpful 🙂

    Thanks so much!

    Sara

    Reply
    1. Andrew Moodie Post author

      It looks like maybe your GSHHG database path was not correctly set (step 6 of the tutorial). I’m not sure why the file went into that weird subfolder though. I think you’ll want to verify the install is correct to start.

      Reply
  16. hermitofthesouthernmarch

    As of right now (April 26th 2016) this works with 16.04 LTS and GMT 5.3.0 BUT the line numbers in ConfigUser.cmake have increased by a few.

    Thanks!

    Reply
  17. Thomas Pratt

    These instructions worked on 7/6/2016. Only confusion I had was that in the ConfigUser.cmake file, the path to the two folders has to include the names of the folders themselves, not just the directory they are in.

    Reply
  18. Amit

    Hi,
    I’m getting this error while installing GMT

    collect2: error: ld returned 1 exit status
    make[2]: *** [src/JL] Error 1
    make[1]: *** [src/CMakeFiles/JL.dir/all] Error 2
    make: *** [all] Error 2

    Reply
    1. henk

      Hi there,
      I get the same error during the “make” command while “Linking C executable gmt”. Would be glad to hear an idea 🙂

      Oh, and great tutorial by the way.

      Reply
  19. Luis M.

    Hey man, it’s very easy to install the program with a tutorial like this.

    These instructions worked on 25/08/2016 and I installed the software in Ubuntu 16.04 LTS.

    I had no problem installing the software with the latest files:

    – gshhg-gmt-2.3.6.tar.gz
    – dcw-gmt-1.1.2.tar.gz

    Thank you very much.

    Reply
  20. Fawz Naim

    When I type any command containing “pscoast” , it gives error:
    pscoast: GSHHG version 2.2.0 or newer is needed to use coastlines with GMT.
    Get and install GSHHG from ftp://ftp.soest.hawaii.edu/gshhg/.
    pscoast: Could not find file [GSHHG intermediate resolution shorelines]
    pscoast: No GSHHG databases available – must abort

    Please help me to solve the issue.

    Reply
  21. Kukuh Sudarsono

    Like Luis M., I’ve tried installing GMT with newer version of components. It works! So easy, without any problem encountered. You should get an honor for this, Sir! Thank you very much!

    Reply
  22. Jarrod Walker

    Hi Andrew,
    I would like to thank you for your tutorial. This made installing gmt so much easier!
    I would like to point out one thing. When editing the ConfigUser.cmake file the line numbers were slightly different to those you have here (I’m using Ubuntu 14.04.02). line 99 = 107, line 102 = 110, 105 = 113, 108 = 116.
    This shouldn’t be an issue for most people i but thought i would just point it out (but you probably already knew this)
    thank you again
    Jarrod

    Reply
    1. Andrew Moodie Post author

      Jarrod, thanks for the tip, this happens periodically as the GMT developers change around the format of the .cmake file. I’ll update accordingly.

      Reply
  23. Brad

    Hi Andrew,

    My install seemed to go well on Ubuntu 16 with the latest gshhg & dcw files , but when I attempt to run gmt I receive the following message:

    “Error: Could not find system defaults file /usr/local/gmt5-dev/share/dbase/conf/gmt.conf – Aborting.”

    Am I missing something?

    Thanks

    Reply
    1. Andrew Moodie Post author

      try the install again, simply following the steps. Are you sure you edited the ConfigUser.cmake file properly? i.e., steps 5 and 6.

      Reply
  24. Aakash Anand

    Sir
    I had all my codes which was compatible with gmt version 4.5.6 but this version doesn’t support that…
    Like in pstext it’s giving problem also the font size (ANNOT).. it’s giving problem. Basically the gmt configuration is changed in the new version…
    I tried to uninstall it so that I could install the earlier version but could not UNINSTALL it.

    Kindly help.
    Thanking
    Aakash

    Reply
    1. Andrew Moodie Post author

      To uninstall you can see this answer on stack exchange. However, I would recommend you just take the time to update your scripts to GMT compatability. In the “error” messages you receive it should tell you that the name you are using is depreciated, and you should use something else instead. The options are all the same, they are just renamed. Just replace the old option name with the new one and rerun your script.

      Reply
  25. Becky Salvage

    Hi,
    Your tutorial has worked great, up until the last step!! I try to call the make command and I get the following error:

    [100%] Linking C executable gmt
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_get_peer_certificate@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `CRYPTO_num_locks@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_get_current_compression@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CTX_free@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_get_version@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `BIO_int_ctrl@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ENGINE_free@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `CRYPTO_get_id_callback@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ASN1_STRING_data@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `OPENSSL_config@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_get_error@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_NAME_get_entry@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_use_PrivateKey_file@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_STORE_load_locations@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpoppler.so.58: referencia a `TIFFDefaultStripSize@LIBTIFF_4.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ASN1_STRING_length@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CIPHER_get_name@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `sk_num@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpoppler.so.58: referencia a `TIFFFdOpen@LIBTIFF_4.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_set_ex_data@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpoppler.so.58: referencia a `TIFFWriteScanline@LIBTIFF_4.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_read@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_STORE_set_flags@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSLv23_method@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ENGINE_load_private_key@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `BIO_new@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `BIO_set_flags@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_get_subject_name@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `CRYPTO_get_locking_callback@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_NAME_ENTRY_get_data@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `sk_value@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `CRYPTO_set_id_callback@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpoppler.so.58: referencia a `TIFFClose@LIBTIFF_4.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CTX_new@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CTX_get_cert_store@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_check_private_key@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ENGINE_by_id@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `BIO_s_socket@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ERR_put_error@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ERR_get_error@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `CRYPTO_set_locking_callback@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_load_error_strings@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_new@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_get_current_cipher@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `BIO_clear_flags@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_write@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_free@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CTX_load_verify_locations@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_free@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_ctrl@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpoppler.so.58: referencia a `TIFFSetField@LIBTIFF_4.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ERR_clear_error@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_set_verify@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ENGINE_init@OPENSSL_1.0.0′ sin definir
    /usr/lib/gcc/i686-linux-gnu/5/../../../../lib/libgdal.so: referencia a `sqlite3_column_table_name’ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CIPHER_get_bits@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_connect@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_NAME_get_index_by_NID@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ERR_reason_error_string@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_set_bio@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_CTX_ctrl@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `sk_free@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_pending@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_use_PrivateKey@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `ENGINE_finish@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `X509_get_ext_d2i@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_library_init@OPENSSL_1.0.0′ sin definir
    //usr/lib/i386-linux-gnu/libpq.so.5: referencia a `SSL_shutdown@OPENSSL_1.0.0′ sin definir
    collect2: error: ld returned 1 exit status
    src/CMakeFiles/gmt.dir/build.make:112: fallo en las instrucciones para el objetivo ‘src/gmt’
    make[2]: *** [src/gmt] Error 1
    CMakeFiles/Makefile2:365: fallo en las instrucciones para el objetivo ‘src/CMakeFiles/gmt.dir/all’
    make[1]: *** [src/CMakeFiles/gmt.dir/all] Error 2
    Makefile:149: fallo en las instrucciones para el objetivo ‘all’
    make: *** [all] Error 2

    I have tried uninstalling and reinstalling, as well as changing the anaconda directory (where ssl is) to another name, but this throws up more errors.

    Please help!

    Thanks,
    Becky

    Reply
    1. Andrew Moodie Post author

      Hi Becky, installing through SSL is beyond anything I’ve tried to work before, but it shouldn’t change anything once you are connected and properly authenticated, I would think. Are you running the commands as root (sudo) when necessary? Are you sure you are putting the correct path names everywhere during install? Make sure they are defined in absolute terms to the machine you are SSLed to. I guess these seem like basic questions, but I can’t offer you any help in terms of SSL install. AM.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *