How do I install GMT (6.1.1) on my Windows, using cygwin

Wow!
Thanks again @Andreas

considering the Assignments given, I am posed with several lines of codes to run on bash. Hence, I will continue with your method.
Since you’re using this platform, I believe you’ll continue to assist me!

Update:
I have been able to update and upgrade successfully.
Also, I was able to perform the rest of the previous codes, but with 2 constrains:

  1. I wasn’t able to run ( mv gshhg-gmt-*/* ~/gmt/share/coast) successfully, I skipped it and ran the remaining lines of code.
  2. After successfully downloading and extracting the files, the installation code which is the last task brought the following prompt (-bash: cd: too many arguments)


Should try installing them in batches? @Andreas

Thanks for your time and assistance…
Hoping to hear from you soonest!

Please do a ls -l ~/gmt/share/coast to check that the gshhg files are present.

And I forgot to put && at the end of the cd command.

Try:

cd ~/gmt/b \
 && cmake ~/gmt/gmt \
-DCOPY_GSHHG=TRUE \
-DCOPY_DCW=TRUE \
-DGSHHG_ROOT=~/gmt/share/coast \
-DDCW_ROOT=~/gmt/share/dcw \
-DGMT_OPENMP=ON \
&& cmake --build . \
&& sudo cmake --build . --target install
1 Like

It returned gshhg.tar.gz instead!
install_3

would I need to re-download or unzip the file @Andreas
Also, it is showing gsshg instead of gshhg.

GSSHG is correct, I misspelled. It did not extract the tarball. Try:

cd ~/gmt/share/coast
tar -zxvf gsshg-gmt-2.3.7.tar.gz

and then again:

cd ~/gmt/b \
 && cmake ~/gmt/gmt \
-DCOPY_GSHHG=TRUE \
-DCOPY_DCW=TRUE \
-DGSHHG_ROOT=~/gmt/share/coast \
-DDCW_ROOT=~/gmt/share/dcw \
-DGMT_OPENMP=ON \
&& cmake --build . \
&& sudo cmake --build . --target install
1 Like

Dear @Andreas,

I am satiated with profound joy…What took me several days and abrupt night rest, was solved by your sagacity, patience, and willingness to help me. I bless you from my heart! This is the output!


Thanks once again @Andreas

Going forward, I will need assistance on how to navigate my way around the app. Such as:

  1. Using the given files to plot topo maps, and other maps.
  2. Where do I create my files (is it in the /b directory?)
    3. The next step I need to take from here.

Also, if you have materials that I could peruse in expediting my knowledge on GMT and its environmental functions, I deeply welcome it.
Thanks again and again @Andreas

Glad it worked out for you @Johnie!

If you’re new to GMT, you really should go through the tutorial (https://docs.generic-mapping-tools.org/latest/tutorial.html) and the Cookbook (https://docs.generic-mapping-tools.org/latest/cookbook.html). The most important thing is however; try things out for yourself. Test and play with it. Make mistakes. You’ll learn alot from this.

I don’t know the technical details, but WSL has it’s own kind of filesystem, which is generally hidden from Windows’ that you’re used(?) to. You can run GMT everywhere you want, but assuming that you’ll use Windows programs to e.g. look at the figures, it’s best to work in a place easily accessable from both systems. I tend to use the desktop. To reach the ‘Windows filesystem’ you do:

cd /mnt/c

Try doing an ls -l; what you see should be somewhat familiar. Then go to your desktop:

cd /mnt/c/Users/<your username/Desktop

Make a file:

echo "Hello from WSL" > hello.txt

You should now see a file called hello.txt on your Windows desktop.

Make a folder and try to make a plot or two:

mkdir plot
cd plot
gmt psbasemap -R10/70/-3/8 -JX4i/3i -Bafg -B+glightred+t"My first plot" > my_first_plot.ps

If you’re new to the terminal and bash you might feel that the learning curve is steep, but once you get the hang of it becomes very powerful (as GMT itself).

Yes!

I will give attention to the tutorial sites and I’m truly grateful for all you have done.
I was able to locate the path where Ubuntu saves the folder on the PC via: C:\Users\<PC name>/AppData\Local\Packages\CanonicalGroupLimited... But, using the Desktop directory you highlighted is just perfect!

Also, I tried running the my_first_plot.ps but didn’t see any plotted figure or output!
I downloaded and installed Ghostscript using sudo apt install gv, which was successful, but still didn’t output any figure.

I making the file into an executable file and also tried running the file using the Ghostscript, all resulting in zero output!

Can you please explain what I need to do, in order to output these figures @Andreas!
Thanks in anticipation.

What you’re trying to do is correct if you used a Window manager on Ubuntu (e.g. Xorg). But since you’re on Windows, we can deal with that at a later stage :slight_smile:.

If you want to open the postscript file, I would suggest you install ghostscript and GSview on Windows;
Ghostscript: https://www.ghostscript.com/download/gsdnld.html - choose Ghostscript 9.53.3 for Windows (64 bit) with the Ghostscript AGPL Release
GSview: http://www.ghostgum.com.au/software/gsview.htm - choose Win64 (x86_64)

After you’ve installed those, you should be able to double click my_first_plot.ps and it should open in GSview.

Based on your screenshots: remember that the file plotMap.sh only contains text (commands) for GMT to execute (I assume). GMT interprets those commands and outputs Postscript, which basically is text (it’s a descriptive programming language), that tells a program (GSView in this case) how your figure should look like. So there is no need to make the *.ps executable.

Try to do a gmt psbasemap -R10/70/-3/8 -JX4i/3i -Bafg -B+glightred+t"My first plot" without redirecting to a file, and behold the postscript pouring at you.

PS! If you dont care about the Postscript-files, you can use psconvert -Tf -A my_first_plot.ps to convert the figure to PDF. I’m sure you’re able to look at PDF’s without installing new software.

1 Like

Wow :grinning:
I’m glad I’m catching up! Thanks, @Andreas
So, I performed all the tasks you itemized which was very successful!

But, I wasn’t able to convert the *.ps file to pdf. Which of the libraries would I have to download?

Also, I downloaded and installed the Ghostscript 64 bit, but wasn’t able to install the downloaded gs (x86_64)

GS_install

So, I tried installing the 32 bit Ghostscript and Gsview…, but wasn’t able to view the .ps file as it resulted in the following error:

    GSview 5.0 2012-01-17
    Unknown in Comments section at line 7:
      %%DocumentNeededResources: font Helvetica

Unknown in Page section at line 677:
  %%BeginObject PSL_Layer_1

Unknown in Page section at line 823:
  %%EndObject

Failed to load C:\Program Files (x86)\Ghostgum\gs7.04\bin\gsdll32.dll, error 126
The specified module could not be found.



Failed to load C:\Program Files (x86)\Ghostgum\gsview\gsdll32.dll, error 126
The specified module could not be found.



Failed to load gsdll32.dll, error 126
The specified module could not be found.



Can't load Ghostscript DLL

How do I solve these challenges Sir @Andreas :innocent:

I’m sorry, I forgot to put gmt at the start of the command.

It should be gmt psconvert -Tf -A my_first_plot.ps. (Note -Tf, not -If)

Now for the trouble with GSview, I’m not sure why this. Did you manage to install ghostscript successfully? It looks like GSview doesnt find ghostscript.

1 Like

Spot on: :raised_hands:
Thanks, @Andreas
Converted and it outputted successfully!

I actually installed the Ghostscript prior to the GSview. But, I will try it again.
Thanks once again @Andreas

One more thing It means I have to save the script with the .ps extension?

Great!

You can create a script and call it whatever you want. I use .sh so I know it’s a script. You should not use .ps since that indicates that it’s a postscript file.

Use an editor that you like, e.g. nano and make a simple script, then execute it:

$ nano test.sh

And write:

ps=test.ps
gmt psbasemap -R10/70/-3/8 -JX4i/3i -Bafg -B+glightred+t"My first plot" > $ps
gmt psconvert -Tf -A $ps

Exit and save by pressing Ctrl+x.

Then execute the script with:

bash test.sh

Or

chmod a+x #to make it executable
./test.sh

Hi @Andreas
I trust you have been good. I apologize for the late response, I have been studying :blush:

First, I have installed the gsview on my laptop! The reason for the previous error was that I had downloaded the recent version of the Ghostscript, and the gsview requires a version lesser than 9.99. I was able to solve the puzzle by downloading and installing Ghostscript 9.52. I think I have the full package on my laptop now!
Thanks again @Andreas

Second, I wasn’t able to run your simple code as it brought this error:

Third, I was able to do the first assignment given.
I am truly grateful for all your assistance @Andreas

Thank you.

Great! You’re welcome.

If you copy/pasted my code it should work. It’s works at my end at least. Just try to remove the offending option and write instead:

gmt psbasemap -R10/70/-3/8 -JX4i/3i -Bafg > $ps

In either case, it looks like you have gmt up and running. Congratulations!

1 Like

Hi @Andreas,
I trust you have been very good!
Thank you so much for your assistance throughout my installation process. I have been practicing and modify codes with supporting documents, and I have been able to output the files successfully in .ps and .pdf file format. But, I think I am having difficulty in outputing a oneliner code just like the one you gave me. This is another example with the following errors.
$ gmt coast -R19.42/22.95/59.71/60.56 -W0.1p,black -png archi_sea

What is your suggested solutions @Andreas? Are there things I still need to download.
I look forward to your response.
Thanks in anticipation.

On Linux you will need to have xdg-open installed. The instructions for installing GMT on Ubuntu for instance says you need this:

sudo apt-get install xdg-utils
1 Like

If you want to use graphical stuff with Ubuntu (WSL) you also need a Window manager (e.g. Xorg). The only thing you would get out of this is that gmt automatically opens the figure for you (I think).

It’s a long time since i tried Xorg on/with WSL. I think I used Xming X Server for Windows.

1 Like

Wow!

Thanks, @pwessel! I have successfully installed xdg-utils and it solved the problem.

@Andreas, Ubuntu was able to use my windows 10 image viewer to popup the image, after bringing the error Error: no "view" mailcap rules found for type "image/png"

But, in all, I was able to solve the puzzle. I am following a steady process on how to write codes to draw maps and use the GMT as a whole, and I needed to see the step-to-step output from my PC. In general, I am very grateful to @Andreas, Joaquim, @pwessel, and the entire GMT community for your unwavering support.
Thanks in total admiration.

Happy New Month all!

You’re welcome @Johnie. Glad to hear.

It’s rewarding to help and get others going. I’ve also received lot of help over the years. Being able to give something back is wonderful.

1 Like