R devtools fails as "Package libxml-2.0 was not found in the pkg-config search path"

OK so in the end I had to manually install libxml2 even though my system said it allready had the most up to date version installed after: sudo apt-get install libxml2 libxml2-dev

I manually installed based on info found here:

wget ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz

then after unpacking and moving into the folder:

./configure --prefix=/usr --disable-static --with-history && make

and

sudo make install

after this the R command install.packages("devtools") completed with success.


Choose and Install suitable library from below as per your Linux flavor:-

  • deb: libxml2-dev (Debian, Ubuntu, etc)
  • rpm: libxml2-devel (Fedora, CentOS, RHEL)
  • csw: libxml2_dev (Solaris)

Install with an appropriate command like apt-get, yum, etc.


From within R prompt, this command works provided that libxml2-dev has been installed:

Sys.setenv(PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig")