[R-SIG-Mac] configure: error: "liblzma library and headers are required"

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Sun Jun 12 01:29:01 CEST 2022


most package systems (ours as well as Homebrew) don't use /usr/local on arm64 to not cause inadvertent conflicts with x86_64 binaries, so they must be explicitly added to flags. You failed to provide any details, but I suspect you didn't configure R to use whichever location is necessary for the dependencies since only /usr/local is searched by default. The flags used by CRAN can be seen at
which works for the binaries installed using 


(Tcl/TK is not included, if needed you can install it from the release package).

Note that PATH has nothing to do with locating libraries by dyld - PATH is only used for executables so your $LOCAL/bin has to be on the PATH for pkg-config. Also note that mixing different systems is prone to cause chaos, because static and dynamic libraries have different precedence. So make sure you pick one choice (CRAN or Homebrew or Macport etc.) and stick with it.


> On Jun 12, 2022, at 1:52 AM, Marius Hofert <marius.hofert using uwaterloo.ca> wrote:
> Hi,
> I'd like to install R from source on a MacBook Pro 14 (M1 Pro Max) and do that
> for the first time under Apple Silicon.  I could install all preliminaries from
> source as I normally did under Intel Macs (even tcl and tk, gsl, gmp, mpfr, etc.).
> However, the configure step of R fails with:
> ...
> checking for lzma_version_number in -llzma... yes
> checking for lzma.h... no
> configure: error: "liblzma library and headers are required"
> Related to this problem, I found the references below. However, none of the
> suggested solutions worked for me.
> The problem seems to be the installation of xz (and, as the references suggest, a similar
> problem will arise from pcre2). The header file lzma.h is not found.
> Here are the things I tried:
> 1) A plain 'brew install xz'.
> 2) Adding the directories where lzma.h is found to PATH:
> /usr/local/bin/xz/include/lzma.h
> /opt/R/arm64/include/lzma.h
> /opt/homebrew/include/lzma.h
> /opt/homebrew/Cellar/xz/5.2.5/include/lzma.h
> 3) Following https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Native-builds:
> 3.1) Creating /opt/R/arm64
> 3.2) Downloading xz-5.2.5-darwin.20-arm64.tar.xz from https://mac.r-project.org/bin/darwin20/arm64/
> and unpacking it to /opt/R/arm64
> 3.3) Adding /opt/R/arm64 to PATH
> How can xz be installed in Apple Silicon so that configure finds it including headers?
> Let me know if you need more information.
> Thanks & cheers,
> Marius
> References:
> https://groups.google.com/g/r-sig-mac/c/UPPDNxn7ab4
> https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Prerequisites
> https://mac.r-project.org/bin/darwin20/arm64/
> https://www.mail-archive.com/r-sig-mac@r-project.org/msg05844.html
> https://stackoverflow.com/questions/40222371/install-r-with-shared-library-in-osx-liblzma-library-missing
> https://pj.freefaculty.org/blog/?p=315
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

More information about the R-SIG-Mac mailing list