[Solved] Linux R Pack Error: cram/cram_io.c:61:10: fatal error: lzma.h: No such file or directory

Error message

Operating system: Ubuntu 20.04 64 bit

An error occurred while installing rhtslib package. Error message:

> BiocManager::install("Rhtslib")
cram/cram_io.c:61:10: fatal error: lzma.h: No such file or directory
   61 | #include <lzma.h>
      |          ^~~~~~~~
compilation terminated.
make[1]: *** [Makefile.Rhtslib:128: cram/cram_io.o] Error 1
make[1]: Leaving directory '/tmp/Rtmp428cj4/R.INSTALL14a4e8febbab/Rhtslib/src/htslib-1.7'
make: *** [Makevars.common:24: htslib] Error 2
ERROR: compilation failed for package ‘Rhtslib’
* removing ‘/usr/local/lib/R/site-library/Rhtslib’

The downloaded source packages are in
	‘/tmp/RtmpcHBCud/downloaded_packages’

Solution:

Generally, the compilation fails due to the lack of packages in the system. Solve such problems by installing libbz2 dev, zlib1g Dev and liblzma dev:

sudo apt-get install libbz2-dev
sudo apt-get install zlib1g-dev
sudo apt-get install liblzma-dev

Read More: