JuliaInterop / RCall.jl

Call R from Julia
Other
319 stars 59 forks source link

RCall Build Error on Mac M1 #473

Closed jim2236 closed 1 year ago

jim2236 commented 1 year ago

I am running Julia 1.7 on a MacBook M1 Max, Ventura 13.1. I get the same results for Julia 1.8. I tried building RCall but continue to get the following error message regardless of the installation method I use. I think this is an architecture issue, but not sure it that is accurate.

ERROR: Error building RCall: ERROR: could not load library "/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib" dlopen(/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib, 0x0001): tried: '/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib' (no such file), '/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) ERROR: LoadError: Try adding /opt/homebrew/Cellar/r/4.2.2/lib/R/lib to the "LD_LIBRARY_PATH" environmental variable and restarting Julia. Stacktrace: [1] error(s::String) @ Base ./error.jl:33 [2] validate_libR(libR::String) @ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:26 [3] locate_libR(Rhome::SubString{String}) @ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:43 [4] top-level scope @ ~/.julia/packages/RCall/Wyd74/deps/build.jl:58 [5] include(fname::String) @ Base.MainInclude ./client.jl:451 [6] top-level scope @ none:5 in expression starting at /Users/squeeks/.julia/packages/RCall/Wyd74/deps/build.jl:11

caused by: could not load library "/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib" dlopen(/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib, 0x0001): tried: '/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib' (no such file), '/opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) Stacktrace: [1] dlopen(s::String, flags::UInt32; throw_error::Bool) @ Base.Libc.Libdl ./libdl.jl:117 [2] dlopen (repeats 2 times) @ ./libdl.jl:117 [inlined] [3] validate_libR(libR::String) @ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:16 [4] locate_libR(Rhome::SubString{String}) @ Main ~/.julia/packages/RCall/Wyd74/deps/setup.jl:43 [5] top-level scope @ ~/.julia/packages/RCall/Wyd74/deps/build.jl:58 [6] include(fname::String) @ Base.MainInclude ./client.jl:451 [7] top-level scope @ none:5

I've installed R before starting Julia from the CRAN package, and installed Quartz as recommended on the R webpage, and set the LD_LIBRARY_PATH as recommended. I set the path to opt/homebrew/Cellar/r/4.2.2/lib/R/lib/libR.dylib, and then R RHOME/lib. I uninstalled that and installed R with Homebrew. I set the LD_LIBRARY_PATH as recommended. I continue to get the same error.

I would appreciate help with this issue. Thanks.

simonbyrne commented 1 year ago

what is your Julia versioninfo()?

simonbyrne commented 1 year ago

I suspect the issue is that you're using the Intel x86 Julia binary (via Rosetta), but the native ARM R binary. The easiest option is to switch to the native ARM Julia binary.

jim2236 commented 1 year ago

I installed Julia 1.8.4 ARM, which did work. l can work with this.

Thank you,

On Dec 28, 2022, at 4:39 PM, Simon Byrne @.***> wrote:

I suspect the issue is that you're using the Intel x86 Julia binary (via Rosetta), but the native ARM R binary. The easiest option is to switch to the native ARM Julia binary.

— Reply to this email directly, view it on GitHub https://github.com/JuliaInterop/RCall.jl/issues/473#issuecomment-1366929688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQBO3BUFLF26FTEORG565GDWPSXRZANCNFSM6AAAAAATLSCS74. You are receiving this because you authored the thread.

dmbates commented 1 year ago

@jim2236 @simonbyrne Can this issue be closed? It seems to have been resolved.

jim2236 commented 1 year ago

Douglas,

I reinstalled Julia and solved the problem. The issue can be closed.

Thank you Jim Michael

On Feb 11, 2023, at 11:12 AM, Douglas Bates @.***> wrote:

@jim2236 https://github.com/jim2236 @simonbyrne https://github.com/simonbyrne Can this issue be closed? It seems to have been resolved.

— Reply to this email directly, view it on GitHub https://github.com/JuliaInterop/RCall.jl/issues/473#issuecomment-1426811485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQBO3BU5DIED3BL5SNMFURLWW627NANCNFSM6AAAAAATLSCS74. You are receiving this because you were mentioned.