Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load libjulia.so because `GLIBCXX_3.4.20' not found #1

Closed
Non-Contradiction opened this issue Sep 4, 2017 · 15 comments
Closed

Comments

@Non-Contradiction
Copy link
Owner

After library(JuliaCall) and julia_setup(), I encountered this error:

Error in dyn.load(.julia$dll_file, FALSE, TRUE) :
unable to load shared object '/storage/work/cxl508/julia/julia-0.6.0/bin/../lib/libjulia.so.0.6':
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /storage/work/cxl508/julia/julia-0.6.0/bin/../lib/libjulia.so.0.6)

And this is the sessionInfo:

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] JuliaCall_0.7.3

loaded via a namespace (and not attached):
[1] compiler_3.4.0

@Non-Contradiction
Copy link
Owner Author

The issue happens because libstdc++.so.6 is too old, update libstdc++6 could solve this. Or maybe you could add the directory $JuliaDir/lib/julia to LD_LIBRARY_PATH which contains all the shared object libjulia needs, for example,
export LD_LIBRARY_PATH=$JuliaDir/lib/julia:$LD_LIBRARY_PATH

@Non-Contradiction
Copy link
Owner Author

Maybe we could add more helpful error messages in this part.

@matbesancon
Copy link

@Non-Contradiction this seems to be the closest issue to what I experience:

R aborting with:

> library(JuliaCall)
> julia_setup()
Julia version 1.1.0 at location /home/user/programs/julia/bin will be used.

  unable to load shared object '/home/user/programs/julia/bin/../lib/libjulia.so.1':
  /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /home/user/programs/julia/bin/../lib/julia/libLLVM-6.0.so)

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

For info:

> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          4.4                         
year           2018                        
month          03                          
day            15                          
svn rev        74408                       
language       R                           
version.string R version 3.4.4 (2018-03-15)
nickname       Someone to Lean On          

@Non-Contradiction
Copy link
Owner Author

Thank you very much for the feedback.
The problem is because R cannot find the version of libstdc++.so.6 that is needed by Julia.
The solution is to export the path /home/user/programs/julia/bin/../lib/ into LD_LIBRARY_PATH or R_LD_LIBRARY_PATH.
I thought I have added some error handling and messages for this... but the error handling doesn't work here. I will add a part of this in README in the troubleshooting section.

@Non-Contradiction
Copy link
Owner Author

The commit ebb3a46 has the issue and the solution in README.

@matbesancon
Copy link

One useful command for people to check if this works:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX, there should be GLIBCXX_3.4.22 in the suggestions

@s439
Copy link

s439 commented Mar 29, 2019

When running julia_setup() through opencpu I am getting the error

"Error in juliacall_initialize(.julia$dll_file) : 
/usr/julia/julia-d386e40c17/bin/../lib/libjulia.so.0.6 - /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/julia/julia-d386e40c17/bin/../lib/libjulia.so.0.6)"

I have set environment varibale R_LD_LIBRARY_PATH in /etc/bashrc and in /etc/opencpu/Renviron aswell
Am I missing something??
Please HELP!

@Non-Contradiction
Copy link
Owner Author

@s439 Thanks for the feedback.
From the error message, we can see that the error happens because libstdc++ in the system is still used instead of the libstdc++ library in the Julia folder.
What is the result of system("$R_LD_LIBRARY_PATH;") in the R session?
How about setting LD_LIBRARY_PATH?

@s439
Copy link

s439 commented Apr 16, 2019

@Non-Contradiction The result is empty "" through opencpu session
I have set both the environment variables LD_LIBRARY_PATH & R_LD_LIBRARY_PATH in all different ways (Including setting the EVs in opencpu session). But no luck.
For the julia_setup() command, I am able to provide JULIA_HOME through the JULIA_HOME parameter.
In the same way, is it possible to forcefully point the libstdc++ library in the Julia folder? (through a parameter of julia_setup() command)

@Non-Contradiction
Copy link
Owner Author

Then it is quite strange, it seems that the R doesn't pick up the R_LD_LIBRARY_PATH, maybe we can try export R_LD_LIBRARY_PATH = blah blah blah and then start R and try julia_setup()?
Currently, it is not possible to set the library path for Julia, but I will add a parameter in the julia_setup() soon.

@mattcbro
Copy link

This issue appears to still be a problem here in 9/9/2020. Sys.getenv() in R, shows that R_LD_LIBRARY_PATH does not exist. Though LD_LIBRARY_PATH does; and the latter can be set with quite a bit of difficulty using Sys.setenv(). The difficulty lies in the fact that you want to do this programmatically using the current values of LD_LIBRARY_PATH.

Nevertheless when I add my local julia/lib directory to this, I get past the GLIBCXX error, but then I start running into a bunch of other missing symbols and libraries.

I now get this error:

Error: Error happens in Julia.
InitError: could not load library "/home/matt/.julia/artifacts/079e2f87254bb2465a44de255cd5dde50d4d0b62/lib/libpangocairo-1.0.so"
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0: undefined symbol: pango_font_get_hb_font
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [2] dlopen at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] __init__() at /home/matt/.julia/packages/Pango_jll/sDpKp/src/wrappers/x86_64-linux-gnu.jl:82
 [4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:782
 [6] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [7] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:771
 [8] _tryrequire_from_serialize

My LD_LIBRARY_PATH does contain the path to the julia libraries, namely.

> Sys.getenv("LD_LIBRARY_PATH")
[1] "/home/matt/programs/julia-1.5.1/lib/julia:/usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/java-8-oracle/lib/server"

@Non-Contradiction
Copy link
Owner Author

@mattcbro Maybe we could try to add the julia library path after the library path of R? Or maybe the end of LD_LIBRARY_PATH?

@mattcbro
Copy link

The problems is rather subtle. I get library symbol failures whenever I try to use the Plots package inside a user defined module. Somehow the environment changes so that it can't find the libraries in that situation.

I will try to generate a simple example tomorrow.

@mattcbro
Copy link

OK I opened a new issue and provided example code.
#136

@biona001
Copy link

biona001 commented Aug 19, 2022

I had the same exact issue on a cluster which load Julia via the module load Julia command.

For future reference, first I typed which julia which gave the Julia executable path, and it in my .bash_profile as

export R_LD_LIBRARY_PATH=/share/software/user/open/julia/1.6.2/lib/julia

Then JuliaCall works

library(JuliaCall)
julia <- julia_setup(JULIA_HOME = "/share/software/user/open/julia/1.6.2/bin")
julia_exists("sqrt")

[1] TRUE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants