-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Not entirely sure if this issue should go to RCall.jl repo, but here goes.
My problem is that RCall.jl doesn't work out of the box when R is installed in a non-standard location. For example, I tend to compile R manually and switch between different versions. For RCall, this is all fine as long as I do
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/<user>/R/custom_R/R-4.5.0/lib"
ENV["R_HOME"] = "/home/don/R/custom_R/R-4.5.0"
import Pkg
Pkg.build("RCall")after which I can use RCall from Julia without issues. This workaround by setting LD_LIBRARY_PATH is also documented (e.g., https://juliainterop.github.io/RCall.jl/stable/installation/#Other-methods)
In R with JuliaCall, there is no (easy) workaround to achieve the same, hence this issue.
Instead to get JuliaCall to get this to work (i.e., to not segfault when calling julia_setup), I had to change install_dependency.jl
ENV["R_HOME"] = CurrentRhome
+ENV["LD_LIBRARY_PATH"] = "/home/<user>/R/custom_R/R-4.5.0/lib"and rebuildRCall.jl:
ENV["R_HOME"] = CurrentRhome
+ENV["LD_LIBRARY_PATH"] = "/home/<user>/R/custom_R/R-4.5.0/lib"
...
- try
- using RCall
- catch e
- Pkg.build("RCall")
- end
+Pkg.build("RCall")The main reason for omitting the try and immediately calling build is that when RCall is built with a different R than it is loaded from, it segfaults and takes the calling R session along with it.
My proposal is to add some arguments to julia_setup to allow a use to set LD_LIBRARY_PATH.
Thoughts? I'd be happy to open a PR!