Hi, and thanks again Joaquim.
I have now finally managed to establish a proper setup for my linux machine, but not without a LOT of investigation, trial and error and of course YOUR very helpful guiding. Therfore I think it may be helpful to you and also others experiencing similar challanges in the linux installation that I share my setup. Please note that my experience is done in a pure linux environment and that other challenges may occur if GMT is installed under e.g. a Conda environment.
My GMT/Julia folder locations are set by the installation of the respective modules which you have pointed to in earlier posts.
- Folder with GMT v. 6.x.x installation: /home/fg/GMT/
- Folder with GMT.jl wrapper installation: /home/fg/gmt/
- Folder with Julia installation: /home/fg/julia/
Added the following lines to my .bshrc file:
export PATH="$PATH:$HOME/GMT/bin"
export PATH="$PATH:$HOME/gmt/bin"
export PATH="$PATH:$HOME/julia/bin"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/fg/GMT/lib/
Create startup.jl file AND “config” folder -> /home/fg/.julia/config/startup.jl
where startup.jl contains the following two lines (pointing to the libgmt.so file):
using Libdl
push!(Libdl.DL_LOAD_PATH, “/home/fg/GMT/lib”)
Prepare JuliaCall and GMT within RStudio:
Install JuliaCall package (a one-timer):
> install.packages(“JuliaCall”)
activate JuliaCall library with it’s embedded functions
> library(JuliaCall)
Run Julia setup command (a one-timer):
> julia <- julia_setup()
Install GMT package within R Julia env. (a one-timer):
> julia_install_package(“GMT”)
Activate GMT library with it’s embedded functions:
> julia_library(“GMT”)
There are now at least six (!) different optional ways for me of running GMT commands, 2 in the ordinary linux terminal window (1) Classic mode input as given in the manuals and (2) Modern mode by first starting julia, and 4 others within RStudio:
(3) Start a “Julia console” (within RStudio Console window). Part of JuliaCall package and the “libray(JuliaCall)” command must be run at startup of session.
> julia_console()
A simple Julia console is started -> GMT testplot:
julia> plot(rand(10), show=true)
(4) Run GMT modern commands directly in the RStudio console using “julia_command()”. Part of JuliaCall package and the “libray(JuliaCall)” command must be run first. -> GMT testplot:
> julia_command(“plot(rand(10), show=true);”)
(5) Run GMT classic commands in the RStudio console using RStudio base “system()” command:
> system(“gmt pscoast -R-180/180/-90/90 -Dc -W -M > world_crude.txt”)
(6) Run GMT modern commands directly in the RStudio terminal window by first starting Julia:
$ julia
julia> using GMT
-> GMT testplot:
julia> plot(rand(10), show=true)
Hope this may be helpful for others!