R library breaks due to failure in loading dyld

Viewed 236

I have installed r with Homebrew and installed the INLA package for spatial analysis.

Unfortunately when using this module I get the following error:

dyld: Library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib Referenced from: /usr/local/Cellar/r/3.4.1_1/lib/R/lib/libR.dylib Reason: Incompatible library version: libR.dylib requires version 8.0.0 or later, but liblzma.5.dylib provides version 6.0.0

I have already installed the xz library with Homebrew which installs liblzma, otool -L /usr/local/lib/liblzma.5.dylib returns:

/usr/local/lib/liblzma.5.dylib: /usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.3.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

This seem to indicate that I have the required version despite the exception raised by r.

Any help solving this issue will be deeply appreciated.

2 Answers

I haven't been able to solve the problem with the Homebrew r, but I decided instead to install the packaged version of R from the CRAN website.

The libR.dylib from the package version does not seem to depend on liblzma.5.dylib. INLA then works without error.

Any answer that manages to use Homebrew r should probably be upvoted.

In my case a similar error was fixed by reinstalling xz with the commands below, then reinstalling the r package.

brew unlink xz

brew reinstall xz

Related