JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

Segmentation Fault calling JuliaCall::julia_setup #129

Open styx0r opened 4 years ago

styx0r commented 4 years ago

Hi, I'm getting a segmentation fault when calling JuliaCall::julia_setup(rebuild=T):

Julia version 1.4.0 at location /Applications/Julia-1.4.app/Contents/Resources/julia/bin will be used.
Loading setup script for JuliaCall...

signal (11): Segmentation fault: 11
in expression starting at /usr/local/lib/R/3.6/site-library/JuliaCall/julia/setup.jl:72
GetNewPage at /Builds/R-builds/nightly/el-capitan-x86_64/R-3.5.1/src/main/../../../../R-3.5.1/src/main/memory.c:907
Rf_allocVector3 at /Builds/R-builds/nightly/el-capitan-x86_64/R-3.5.1/src/main/../../../../R-3.5.1/src/main/memory.c:2539
Rf_allocVector at /Builds/R-builds/nightly/el-capitan-x86_64/R-3.5.1/src/main/../../../../R-3.5.1/src/include/Rinlinedfuns.h:577 [inlined]
Rf_ScalarInteger at /Builds/R-builds/nightly/el-capitan-x86_64/R-3.5.1/src/main/../../../../R-3.5.1/src/include/Rinlinedfuns.h:984
__init__ at /Users/baldow/.julia/packages/RCall/g7dhB/src/setup.jl:162
unknown function (ip: 0x133d48351)
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1692 [inlined]
jl_module_run_initializer at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:74
jl_init_restored_modules at /Users/julia/buildbot/worker/package_macos64/build/src/dump.c:2519
_include_from_serialized at ./loading.jl:697
_require_search_from_serialized at ./loading.jl:781
_require at ./loading.jl:1006
require at ./loading.jl:927
require at ./loading.jl:922
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1692 [inlined]
call_require at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:399 [inlined]
eval_import_path at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:436
jl_toplevel_eval_flex at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:656
jl_eval_module_expr at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:181
jl_toplevel_eval_flex at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:640
jl_parse_eval_all at /Users/julia/buildbot/worker/package_macos64/build/src/ast.c:872
jl_load at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:872 [inlined]
jl_load_ at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:879
include at ./Base.jl:377
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1692 [inlined]
do_call at /Users/julia/buildbot/worker/package_macos64/build/src/interpreter.c:369
eval_body at /Users/julia/buildbot/worker/package_macos64/build/src/interpreter.c:0
jl_interpret_toplevel_thunk at /Users/julia/buildbot/worker/package_macos64/build/src/interpreter.c:911
jl_toplevel_eval_flex at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:814
jl_toplevel_eval_flex at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:764
jl_toplevel_eval at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:823 [inlined]
jl_toplevel_eval_in at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:843
jl_eval_string at /Users/julia/buildbot/worker/package_macos64/build/src/jlapi.c:114
_Z13juliacall_cmdPKc at /usr/local/lib/R/3.6/site-library/JuliaCall/libs/JuliaCall.so (unknown line)
_JuliaCall_juliacall_cmd at /usr/local/lib/R/3.6/site-library/JuliaCall/libs/JuliaCall.so (unknown line)
do_dotcall at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
bcEval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_eval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
R_execClosure at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_applyClosure at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
bcEval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_eval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
R_execClosure at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_applyClosure at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
bcEval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_eval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
R_execClosure at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_applyClosure at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_eval at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
Rf_ReplIteration at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
R_ReplConsole at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
run_Rmainloop at /usr/local/Cellar/r/3.6.3_1/lib/R/lib/libR.dylib (unknown line)
main at /usr/local/Cellar/r/3.6.3_1/lib/R/bin/exec/R (unknown line)
Allocations: 2502 (Pool: 2493; Big: 9); GC: 0

 *** caught segfault ***
address 0x18, cause 'memory not mapped'

Traceback:
 1: juliacall_cmd(cmd)
 2: .julia$cmd(paste0("Base.include(Main,\"", system.file("julia/setup.jl",     package = "JuliaCall"), "\")"))
 3: JuliaCall::julia_setup(rebuild = T)

In the following my system specs: OS: OS X 10.15.4 R Version:

platform       x86_64-apple-darwin19.3.0   
arch           x86_64                      
os             darwin19.3.0                
system         x86_64, darwin19.3.0        
status                                     
major          3                           
minor          6.3                         
year           2020                        
month          02                          
day            29                          
svn rev        77875                       
language       R                           
version.string R version 3.6.3 (2020-02-29)
nickname       Holding the Windsock

JuliaCall Version:

> packageVersion('JuliaCall')
[1] ‘0.17.1’

Julia Version:

julia> versioninfo()
Julia Version 1.4.0
Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.6.0)
  CPU: Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, haswell)
Non-Contradiction commented 4 years ago

Thanks for the report! JuliaCall currently seems to have some problem with Julia 1.4 and I'm working on it. Would you please check the result of

using RCall

in Julia directly? Thanks!

styx0r commented 4 years ago

No problem with

using RCall

in Julia directly. I also played around with it, works like expected.

Non-Contradiction commented 4 years ago

Thanks! One strange thing I noticed is that although R version is 3.6, there are some R 3.5 lines from the segfault traceback. What is the result of RCall.Rhome?

styx0r commented 4 years ago
julia> RCall.Rhome
"/Library/Frameworks/R.framework/Resources"

Within this directory there is the R executable of 3.6.3.

styx0r commented 4 years ago

Don't know whether it helps, but if I'm running

julia /usr/local/lib/R/3.6/site-library/JuliaCall/julia/setup.jl

no error occurs. So to me it looks like something is wrong with the environment, when this script is called. Furthermore, no folder with containing R-3.5.1 in the name exists.

styx0r commented 4 years ago

After deleting .julia folder in home, it worked. There seems to be a problem if an older version of julia was installed and used before. So probably these are the steps to reproduce:

Non-Contradiction commented 4 years ago

Thanks for the report! I cannot reproduce the error on my windows laptop and the following works for me:

bbolker commented 4 years ago

Just here to say that I have been working with JuliaCall over the last few days and getting sporadic segfaults. Hard for me to pin anything down so far ... R-devel on Ubuntu 18.04 with Julia 1.4.2, JuliaCall 0.17.1. Will comment here (or elsewhere?) if I can reproduce/localize the problem a bit more ...

pnavaro commented 4 years ago

Just here to say that I have been working with JuliaCall over the last few days and getting sporadic segfaults. Hard for me to pin anything down so far ... R-devel on Ubuntu 18.04 with Julia 1.4.2, JuliaCall 0.17.1. Will comment here (or elsewhere?) if I can reproduce/localize the problem a bit more ...

Same here on macos with Julia 1.5 and R 4.0, but it works with R 3.6.3

idontgetoutmuch commented 2 years ago

I get this with julia version 1.7.1 and R version 4.1.2 (2021-11-01) -- "Bird Hippie" but I don't understand why I get this

dom@MacBook-Pro ~ % julia
julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.1 (2021-12-22)
 _/ |\__'_|_|_|\__'_|  |  Built by Homebrew (v1.7.1_2)
|__/                   |

┌ Warning: Terminal not fully functional
└ @ Base client.jl:385
julia> using RCall
using RCall

julia> RCall.Rhome
RCall.Rhome
"/nix/store/whqn0c8zghjk083h9lqx0c41wapl67kr-R-4.1.2/lib/R"

I assume this is where julia thinks R lives? But R doesn't live there. It lives here

dom@MacBook-Pro ~ % which R
which R
/usr/local/bin/R
thomarse-ef commented 2 years ago

I'm also having this issue,

> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          1.3                         
year           2022                        
month          03                          
day            10                          
svn rev        81868                       
language       R                           
version.string R version 4.1.3 (2022-03-10)
nickname       One Push-Up 
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
tvqt commented 1 year ago

I'm also experiencing this issue!


signal (11): Segmentation fault: 11 expression starting at /Library/Frameworks/R. framework/Versions/4.3-arm64/Resourc es/library/JuliaCall/julia/setup.jl:80
GetNewPage /opt/homebrew/Cellar/r/4.2.1_4/lib/R/lib/libR.dylib (unknown line) at
...
Jo_interpret_coptevet_cnomkat/ApptIcatIONS/JotIa-1.8.app/contents/Resources/jutrar Lub/apla/LibriuLiararternaluabi.deditions/unkinom,.,1.nex/contents/Resources/JuLia/11b/30 (unknown line) lia/libjulia-internal.1.8.dylib /Applications/Julia-1.8.app/Contents/Resources/julia/lib/ju jl_toplevel_eval_flex at (unknown line) lia/libjulia-internal.1.8.dylib /Applications/Julia-1.8.app/Contents/Resources/julia/lib/ju jl_toplevel_eval_flex at lia/libjulia-internal.1.8.dylib (unknown line) /Applications/Julia-1.8.app/Contents/Resources/julia/lib/jul ijl_toplevel_eval_in at ia/libjulia-internal.1.8.dylib (unknown line) ijl_eval_string at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/li (unknown line) bjulia- internal. 1.8. dylib juliacall_cd at /private/var/folders/k4/@jwzxmlnOnb8y6rkzprptb640000gq/T/RtmpJ009h Y/R. INSTALL9689eb6a0fb/JuliaCall/sro/JuliaCall.opp:.54..eschowkeincal _JuliaCall_juliacall_cmdat/private/var/folders/k4/@jwzxmLn0nb8y6rkzprptb640000gq/ T/RtmpJ009hY/R. INSTALL9689eb6a0fb/JuliaCall/src/RcppExports.cpp:33 R_doDotCall at /Volumes/Builds/R4/R-4.3.1/src/main/dotcode.c:868
-perTormEPNSI_10reactor_opt at /ApplIcations/RStud10.app/contents/Resources/app/DIN/ rsession-arm64 (unknown line) Rf_ReplIteration at /Volumes/Builds/R4/R-4.3.1/src/main/main.c:210 R_ReplConsole at /Volumes/Builds/R4/R-4.3.1/src/main/main.c:314 run_Rmainloop at /Volumes/Builds/R4/R-4.3.1/src/main/main.c:1200 Rf _mainloop at /Volumes/Builds/R4/R-4.3.1/src/main/main.c: 1207 anisestutio_bost4asioddetail?/deserviator-unise_op.baselibo,:35const.-Suffer)a10F0 _performEPNS1_10reactor_opE at /Applications/RStudio.app/Contents/Resources/app/bin/ rsession-arm64 (unknown line) ZMi3rstudio_ boost4asiobdetail24descripton. write_op baselIB0,15const buffer; 1 F 0 _performEPNS1_10reactor_opE at /Applications/RStudio.app/Contents/Resources/app/bin/ rsession-arm64 (unknown Line) he masstudile,olapatiesioodiesortpierestialioadoperfoin06-1065-moliplescelibresuperhetSpit ns/Studio.app/Contents/Resources/app/bin/rsession-arm64 (unknown line) Allocations: 7822915 5295); (Pool: GC : 8 7817620; Big:
[apologies if this doesn't make any sense, I used OCR on a recording of my screen, the R Session Aborted sign makes it impossible to copy and paste]
               _                           
platform       aarch64-apple-darwin20      
arch           aarch64                     
os             darwin20                    
system         aarch64, darwin20           
status                                     
major          4                           
minor          3.1                         
year           2023                        
month          06                          
day            16                          
svn rev        84548                       
language       R                           
version.string R version 4.3.1 (2023-06-16)
nickname       Beagle Scouts        

julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65ea (2023-01-08 06:45 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.5.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =