Search code examples
rmacospostgresqllzmaplr

Install R with shared library in OSX - liblzma library missing


Operating system: OSX El Capitan 10.11.6 (15G1004)
R version: version 3.3.1
PostgreSQL 9.5.4 on x86_64-apple-darwin14.5.0, compiled by Apple LLVM version 7.0.0 (clang-700.1.76), 64-bit

I would like to install PL/R on my local PostgreSQL. From the installation page www.joeconway.com/plr/doc/plr-install.html, I opted for the second method and run USE_PGXS=1 make (I am not an expert, I am not sure what this line means), but I get this error:

Package libR was not found in the pkg-config search path.
Perhaps you should add the directory containing 'libR.pc' to the PKG_CONFIG_PATH environment variable.

As I understand from the installation notes at the link above, I need to install R with shared library. I couldn't find any specific instructions, only this one. When I first run sudo ./configure --enable-R-shlib I got an error saying that gfortran was missing and I added it with brew install gcc. Second time I run it, I got this error:

checking lzma.h usability... no
checking lzma.h presence... no
checking for lzma.h... no
configure: error: liblzma library and headers are required.

Searching around, I thought I found a solution by installing the XZ package using the XZ.pkg but it keeps giving me the same error.
I am not sure what I should do next.


Solution

  • When I had the same sort of difficulty (on the same OS version), I installed the xz package from the library cited in the CRAN page for Mac development tools:

    http://R.research.att.com/libs/

    Pick the version that matches your OS version (which is probably the most recent one in your case.)