JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

julia_setup() cannot find libgcc_s.1.dylib from a juliaup installation, within Quarto #207

Closed DomDF closed 1 year ago

DomDF commented 1 year ago

Hi all,

I have previously been able to successfully use JuliaCall, so thank you for your work @Non-Contradiction!

However, I am now having an error, that is very similar to the open issue here: https://github.com/Non-Contradiction/JuliaCall/issues/184. My version of Julia (1.9.2) was also installed using juliaup

A GitHub install of JuliaCall allows me to run the following in R: JuliaCall::julia_setup()

and the below lines in Julia: ENV["R_HOME"] = "/Library/Frameworks/R.framework/Resources" "/Library/Frameworks/R.framework/Resources"

However, when I try and render a Quarto (quarto.org) document with R and Julia code chunks, then I receive the same error messages regarding missing .dylib files that are present in the issue that I listed at the top of this post.

LoadError("/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/JuliaCall/julia/setup.jl", 16, InitError(:Rmath_jll, ErrorException("could not load library... .../lib/libRmath-julia.dylib\

Library not loaded: /workspace/destdir/x86_64-apple-darwin14/lib/libgcc_s.1.dylib\n Referenced from: /Users/ddifrancesco/.../lib/libRmath-julia.dylib\n

Reason: tried: '/workspace/destdir/x86_64-apple-darwin14/lib/libgcc_s.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/workspace/destdir/x86_64-apple-darwin14/lib/libgcc_s.1.dylib' (no such file), '/workspace/destdir/x86_64-apple-darwin14/lib/libgcc_s.1.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk-11.0.18+10/Contents/Home/lib/server/libgcc_s.1.dylib' (no such file)")))

cpfiffer commented 1 year ago

What happens if you try to run Quarto from your command line? E.g.

quarto render
DomDF commented 1 year ago

Thank you for the suggestion. Sadly, this does not resolve the issue

likanzhan commented 1 year ago

I think this is not specific to quarto. Because I encounter a similar error when I try to render a Rnw file with a Julia code block.

likanzhan commented 1 year ago

In my laptop, the file in /Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.dylib is called libgcc_s.1.1.dylib. If I rename the file libgcc_s.1.1.dylib to libgcc_s.1.dylib, it is worked as expected.

DomDF commented 1 year ago

Hi @likanzhan,

Thanks for the suggestion. I tried this, but that gave me the following error:

dyld[42985]: Library not loaded: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libgcc_s.1.1.dylib
  Referenced from: <1199FC6B-BE2F-3AE9-ABD5-ECA4D24BC45D> /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libgfortran.5.dylib
  Reason: tried: '/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libgcc_s.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libgcc_s.1.1.dylib' (no such file), '/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libgcc_s.1.1.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.1.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk-11.0.18+10/Contents/Home/lib/server/libgcc_s.1.1.dylib' (no such file)

Unable to locate an installed version of R.

Did you need to made any other changes so that your version of R so that it would not look for libgcc_s.1.1.dylib?

DomDF commented 1 year ago

OK, I think have managed to solve this by creating a copy of libgcc_s.1.1.dylib and naming it libgcc_s.1.dylib, so both R and JuliaCall find the files they are looking for.

I hope this can assist in creating a more comprehensive solution (perhaps where JuliaCall accepts the original dylib filename?) but given that I have this workaround, I am happy to close this issue.

image