The current documentation talks about being unable to load Julia related dynamic libraries due to GLIBCXX_3.4.20. The proposed solution was to add the julia library path to R_LD_LIBRARY_PATH. Setting this does not fix the problem. Indeed in R Sys.getenv(), does not print R_LD_LIBRARY_PATH.
We can set the environment variable LD_LIBRARY_PATH however to nominally fix this problem. However the error still crops up, if in Julia we have a "using Plot" statement. These simple examples show this problem:
First the Julia module FailLoad.jl . The module won't load if the plot code is enabled. If true is replaced with false, however, it will load.
module FailLoad
export hello
if (true) # change to false and it loads
export tryit
using Plots
function tryit()
plot(1:10, randn(10))
end
end
function hello()
println("hello")
end
end
Here is the R code that tries to load it. Notice the hoops I jump through to append the julia library path to the end of LD_LIBRARY_PATH and running ldconfig
library(stringr)
# points to my julia library
julialib <- "/home/matt/programs/julia-1.5.1/lib/julia"
# fancy syntax for setenv messes up string interpolation. Anyway try to set the Library path for this environment
newpath = paste(julialib, sep=":", Sys.getenv("LD_LIBRARY_PATH"))
# the syntax horror begins just to use setenv to append to the end of LD_LIBRARY_PATH
args = list(newpath)
names(args) = "LD_LIBRARY_PATH"
do.call(Sys.setenv, args)
# need to run ldconfig as root to find the libraries, so we launch a graphical interaction for the password
Sys.setenv(SUDO_ASKPASS="/usr/bin/ssh-askpass")
system("sudo -A ldconfig -v")
library(JuliaCall)
julia <- julia_setup()
# make sure current path is in the Julia search space
julia$eval("mypath = pwd()")
julia$eval("push!(LOAD_PATH, mypath)")
# can't load the module because it uses the Plot package
julia_library("FailLoad")
julia$call("hello")
The current documentation talks about being unable to load Julia related dynamic libraries due to GLIBCXX_3.4.20. The proposed solution was to add the julia library path to R_LD_LIBRARY_PATH. Setting this does not fix the problem. Indeed in R Sys.getenv(), does not print R_LD_LIBRARY_PATH.
We can set the environment variable LD_LIBRARY_PATH however to nominally fix this problem. However the error still crops up, if in Julia we have a "using Plot" statement. These simple examples show this problem:
First the Julia module FailLoad.jl . The module won't load if the plot code is enabled. If true is replaced with false, however, it will load.
Here is the R code that tries to load it. Notice the hoops I jump through to append the julia library path to the end of LD_LIBRARY_PATH and running ldconfig