I just had the same problem when trying to import matplotlib with PyCall this morning. It worked fine in python, so I was a bit confused, but I came to the conclusion that the libstdc++ that ships with Julia is too old, while the one I have installed on my system is up to date. Compiling Julia from source fixed the problem.
Tapped into this one today, but using a Julia source build isn’t a viable workaround. Setting LD_LIBRARY_PATH or R_LD_LIBRARY_PATH, as suggested in http://juliainterop.github.io/RCall.jl/stable/installation.html and some bug reports didn’t help either.
Has anyone gotten rid of this without compiling Julia?
R> library(devtools)
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/gerhard/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so':
/home/gerhard/julia-1.3.1/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/gerhard/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so)
Error: package ‘usethis’ could not be loaded
Through help on Slack by @staticfloat it became clear that the underlying problem is, that the Julia provided libstdc++.so.6 is older than the one provided by the operating system, in my case Ubuntu 19.10, which in turn is used by R.
An intermediate solution is to replace Julias libstdc++.so.6 with the one from the OS:
# works for Ubuntu 19.10 64bit - match your locations accordingly!
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $JULIA_HOME/lib/julia/
For completeness a list of references of this issue:
Not sure where to discuss so doing so here. It seems like you, @laborg, have a good grasp on the issues here. Could you please add a note of sorts to both these repos, JuliaCall and RCall, informing users that run into the same problem on how to resolve these…? That would be a great first step until this gets permanently resolved (by having Julia use the system’s libstdc or updating Julia’s own libstdc in case the system’s version is higher or something).
This issue is not confined to RCall. PyCall also reports the same error. So, the problem is with the Julia distribution and the developers need to be alerted to this problem so that they have the most recent version of libstdc++.so.6 in the compiled version of Julia.
This is a stupid question.
If I build Julia from scratch on (say) a Fedora system or the latest Ubuntu where does the libstdc++ originate from?
IE. Does building from source build an up to date libstdc++ for that system.
Note to self - why dont you take the time to test that hypothesis…