Skip to content

Segmentation fault: 11 #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
s-celles opened this issue Mar 5, 2020 · 13 comments
Closed

Segmentation fault: 11 #348

s-celles opened this issue Mar 5, 2020 · 13 comments

Comments

@s-celles
Copy link

s-celles commented Mar 5, 2020

Hello,

Following discussion https://discourse.julialang.org/t/geodesy-how-to-calculate-the-straight-line-distance-between-two-locations-which-is-represented-by-longitude-and-latitude/19984/12
I'm trying GMT.jl

julia> using GMT

julia> ortho = project(start_pt=[-50.0 10], end_pt=[50 60], step=10, km=true);

julia> coast(region=[-180 180 -90 90], proj=:equidistCylindrical, frame=:g, res=:crude, land=:navy, B=:a)

julia> plot!(ortho, lw=3, lc=:green, name="ortho_line.png", show=true)
Segmentation fault: 11

OS Mac OS 10.13.6

$ gmt --version
6.0.0
(v1.3) pkg> st GMT
    Status `~/.julia/environments/v1.3/Project.toml`
  [5752ebe1] GMT v0.16.0

Any idea about what is wrong with my install?

Kind regards

@joa-quim
Copy link
Member

joa-quim commented Mar 5, 2020

Sorry that you fell into this. How was your GMT6 built? It's our dmg distribution?
Apparently MacOS does very strange things to libs and we get strange dependency failures. See this issue.

If its from the dmg probably the only solution for now is to build GMT yourself (homebrew should be fine)

That command works fine for me on Windows.

@s-celles
Copy link
Author

s-celles commented Mar 5, 2020

I ever installed it using

$ brew install gmt

@joa-quim
Copy link
Member

joa-quim commented Mar 5, 2020

@PaulWessel , @seisman do you confirm the crash?

@seisman
Copy link
Member

seisman commented Mar 6, 2020

Could you convert the Julia script to CLI version?

@joa-quim
Copy link
Member

joa-quim commented Mar 6, 2020

Yes, but that's not the point. The example just plots a line generated by project. The question is why does it crash on Mac? Works fine on Win.

julia> ortho = project(start_pt=[-50.0 10], end_pt=[50 60], step=10, km=true);
       project  -C-50.0/10.0 -E50/60 -G10 -Q

julia> coast(region=[-180 180 -90 90], proj=:equidistCylindrical, frame=:g, res=:crude, land=:navy, B=:a, Vd=1)
        pscoast  -R-180/180/-90/90 -JQ12c -Ba -Dcrude -Gnavy -P -K > C:\TMP\GMTjl_tmp.ps

julia> plot!(ortho, lw=3, lc=:green, name="ortho_line.png", show=true, Vd=1)
        psxy  -R -J -W3,green -K -O >> C:\TMP\GMTjl_tmp.ps

@seisman
Copy link
Member

seisman commented Mar 6, 2020

Tried the CLI version with the homebrew GMT. I don't see a crash.

@joa-quim
Copy link
Member

joa-quim commented Mar 6, 2020

Thanks, as expected. But the real test was to run it from Julia.

@seisman
Copy link
Member

seisman commented Mar 6, 2020

Just tried Julia 1.3.1 + GMT.jl v0.16.0 + GMT 6.0.0 (homebrew), still no crash.

(v1.3) pkg> add GMT
   Cloning default registries into `~/.julia`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `~/.julia/registries/General`
 Resolving package versions...
 Installed GMT ─ v0.16.0
  Updating `~/.julia/environments/v1.3/Project.toml`
  [5752ebe1] + GMT v0.16.0
  Updating `~/.julia/environments/v1.3/Manifest.toml`
  [5752ebe1] + GMT v0.16.0
  [de0858da] + Printf
  [4ec0a83e] + Unicode

julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]

julia> ortho = project(start_pt=[-50.0 10], end_pt=[50 60], step=10, km=true);

julia> coast(region=[-180 180 -90 90], proj=:equidistCylindrical, frame=:g, res=:crude, land=:navy, B=:a)

julia> plot!(ortho, lw=3, lc=:green, name="ortho_line.png", show=true)

@joa-quim
Copy link
Member

joa-quim commented Mar 6, 2020

Thanks again. And again, as expected. @scls19fr sorry, don't know what to say about your case.

@s-celles
Copy link
Author

s-celles commented Mar 6, 2020

Maybe I should try to run gmt binary and see if it crash.

What example should I run ?

Ideally I think I should run something close to what GMT.jl is generating with this example.

So we could isolate if problem is on gmt side or on GMT.jl side.

@joa-quim
Copy link
Member

joa-quim commented Mar 6, 2020

The equivalent pure GMT commands are

gmt project -C-50.0/10.0 -E50/60 -G10 -Q > ortho.dat
gmt pscoast -R-180/180/-90/90 -JQ12c -Ba -Dcrude -Gnavy -P -K > ortho.ps
gmt psxy ortho.dat -R -J -W3,green -O >> ortho.ps
gmt psconvert ortho.ps -A -Tg

In what instruction did you get the crash? Can you please post the the crashing message?

@s-celles
Copy link
Author

s-celles commented Mar 6, 2020

it was crashing on plot! call.

gmt commands works fine.

I did

$ rm -rf /Users/scls/.julia/compiled/v1.3/GMT/

and run again Julia interpreter

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.3.1 (2019-12-30)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]

julia> ortho = project(start_pt=[-50.0 10], end_pt=[50 60], step=10, km=true)
Array{GMT.GMTdataset,1} with 1 segments
First segment DATA
961×3 Array{Float64,2}:
 -50.0     10.0        0.0
 -49.9549  10.0782    10.0
 -49.9098  10.1564    20.0
 -49.8647  10.2346    30.0
 -49.8196  10.3128    40.0
 -49.7744  10.391     50.0
 -49.7292  10.4692    60.0
 -49.684   10.5474    70.0
 -49.6388  10.6256    80.0
 -49.5936  10.7037    90.0
   ⋮
  48.5253  60.1695  9510.0
  48.7018  60.1502  9520.0
  48.8781  60.1306  9530.0
  49.0542  60.1108  9540.0
  49.2301  60.0908  9550.0
  49.4057  60.0705  9560.0
  49.5812  60.05    9570.0
  49.7564  60.0293  9580.0
  49.9314  60.0083  9590.0
  50.0     60.0     9593.92


julia> coast(region=[-180 180 -90 90], proj=:equidistCylindrical, frame=:g, res=:crude, land=:navy, B=:a)

julia> plot!(ortho, lw=3, lc=:green, name="ortho_line.png", show=true)

it's working fine now.

I guess that I shouldn't have installed correctly because I installed first GMT.jl
I tried to run it in Julia interpreter. After typing using GMT I get a message that gmt command line wasn't installed correctly. I installed gmt using brew and try again GMT.jl.

I tried also ] build GMT but it didn't helped.

Removing compiled version of GMT.jl was the solution.

@s-celles s-celles closed this as completed Mar 6, 2020
@joa-quim
Copy link
Member

joa-quim commented Mar 6, 2020

Good that it works now. But still can't understand why it crashed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants