Home > OS >  "liblzma library and headers are required" when installing R-4.2.2 and dependencies under
"liblzma library and headers are required" when installing R-4.2.2 and dependencies under

Time:12-17

I am installing R-4.2.2 under my $HOME path on a Red Hat 4.8.5-28 server.

When I run ./configure --prefix=$HOME/R --enable-R-shlib I found the error:

checking whether bzip2 support suffices... yes
checking for lzma_version_number in -llzma... no
configure: error: "liblzma library and headers are required"

I have install xz-5.2.2, and the headers and library have already been under $HOME/local/include and $HOME/local/lib. The path of the library has also been added to the $C_INCLUDE_PATH and $LD_LIBRARY_PATH. I am not install them to the default path by ways like yum because I do not have the permission.

CodePudding user response:

LD_LIBRARY_PATH is used by the dynamic linker at runtime. The variable plays no role for compilation (and even for runtime configuration it has serious issues and is generally best avoided).

You would normally set LDFLAGS to include the appropriate library paths. However, this should be done by the configure script, not by you. Instead, you would pass the appropriate command line flags to the configure script (something like --with-lzma=the/path), or by configuring the PKG_CONFIG_PATH.

The same is true for the C_INCLUDE_PATH environment variable, incidentally: setting it manually before invoking ./configure is rarely a good idea.

  • Related