Description
On macOS, if we load the julia 1.6 dynamical library and segfault will happen at the jl_init__threading
function. The same segfault doesn't happen with julia 1.5.
For example, with julia 1.6 in R
dyn.load("/Applications/Julia-1.6.app/Contents/Resources/julia/lib/libjulia.1.6.dylib")
.C("jl_init__threading")
which causes the following segfault:
*** caught segfault ***
address 0xfffffffffffffff8, cause 'memory not mapped'
Traceback:
1: .C("jl_init__threading")
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
ERROR: Selection:
And the same code runs fine with julia 1.5 in R
dyn.load("/Applications/Julia-1.5.app/Contents/Resources/julia/lib/libjulia.1.5.dylib")
.C("jl_init__threading")
With julia 1.6 in python3
MacBookdeMacBook-Pro:~ macbookpro$ python3
Python 3.8.2 (default, Dec 21 2020, 15:06:04)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> libjulia = ctypes.PyDLL("/Applications/Julia-1.6.app/Contents/Resources/julia/lib/libjulia.1.6.dylib", ctypes.RTLD_GLOBAL)
>>> libjulia.jl_init__threading()
ERROR: Segmentation fault: 11
MacBookdeMacBook-Pro:~ macbookpro$
And the same code runs fine with julia 1.5 in python3
Python 3.8.2 (default, Dec 21 2020, 15:06:04)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> libjulia = ctypes.PyDLL("/Applications/Julia-1.5.app/Contents/Resources/julia/lib/libjulia.1.5.dylib", ctypes.RTLD_GLOBAL)
>>> libjulia.jl_init__threading()
775
>>> exit()
Discourse post at https://discourse.julialang.org/t/segfault-when-jl-init-in-r-also-python-with-julia-1-6-on-macos/58110/3.
Relevant issue at JuliaInterop/JuliaCall#164.