Ubuntu 14.04 configure: error: "libxml not found" - r

Trying to install the XML package as follows I get the error configure: error: "libxml not found". It seems that R is picking up the libxml2 installation from Anaconda. How can I fix this?
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
> install.packages("XML")
Installing package into ‘/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/XML_3.98-1.19.tar.gz'
Content type 'application/x-gzip' length 1600788 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking for xml2-config... /opt/dev/anaconda/2018.12/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 8 for 2.9.8
Located parser file -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include/parser.h
Checking for 1.8: -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... no
checking for xmlParseFile in -lxml... no
configure: error: "libxml not found"
ERROR: configuration failed for package ‘XML’
* removing ‘/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4/XML’
The downloaded source packages are in
‘/tmp/RtmpannHh6/downloaded_packages’
Warning message:
In install.packages("XML") :
installation of package ‘XML’ had non-zero exit status
>
I also get this:
$ type xml2-config
xml2-config is /opt/dev/anaconda/2018.12/bin/xml2-config
but setting the config in the R environment doesn't help:
Sys.setenv(XML_CONFIG="/opt/dev/anaconda/2018.12/bin/xml2-config")
UPDATE I already had libxml2 installed in the system see:
bravegag#zeus:~$ sudo apt-get install libxml2
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
bravegag#zeus:~$ sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

Make sure your system has the libxml-dev or libxml2-dev package installed. i.e.
sudo apt-get install libxml2-dev
I'm unable to determine which is the right version (libxml or libxml2) for 14.04 but you'll want to make sure you have the -dev version installed.

I had the same error but libxml2-dev was already installed so that didn't help.
What did help was to install libxml through conda using
conda install r-xml
I think there is a problem with the environment variables when you install R through conda.

Related

Clang issues when installing the igraph R package on Mac OS

I'm trying to install the pagoda2 R package on my Mac.
Did the:
brew update
brew install cmake boost eigen gsl curl openssl wget
requirements.
Then downloaded and installed the clang4-r.pkg package.
Then installed gfortran for Mac.
And then in the inside R part, in the:
install_github("igraph/rigraph")
it fails with this error:
* installing *source* package ‘igraph’ ...
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/private/var/folders/t1/t8mvpqx15t50z60z7nqt18y40000gn/T/RtmpNhyp5H/devtools65d816247573/igraph-rigraph-057cc9d':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
ERROR: configuration failed for package ‘igraph’
I tried editing my .R/Makevars file to the following:
# The following statements are required to use the clang4 binary
LDFLAGS=-L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include
#CC=/usr/local/clang4/bin/clang
CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
#CXX=/usr/local/clang4/bin/clang++
CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
#CXX1X=/usr/local/clang4/bin/clang++
CXX1X=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
#CXX98=/usr/local/clang4/bin/clang++
CXX98=/usr/local/clang4/bin/clang
#CXX11=/usr/local/clang4/bin/clang++
CXX11=/usr/local/clang4/bin/clang
#CXX14=/usr/local/clang4/bin/clang++
CXX14=/usr/local/clang4/bin/clang
#CXX98=/usr/local/clang4/bin/clang
CXX98=/usr/local/clang4/bin/clang
#LDFLAGS=-L/usr/local/clang4/lib
# End clang4 inclusion statements
But still same error message.
Any idea?

Problem with R package installation: sf; system library not found

I am trying to install the R package sf. It mentions the system dependencies GDAL, GEOS and PROJ.4. I have installed all of these using
$sudo apt-get install libgdal-dev libgeos-dev libproj-dev proj-bin
However sf still complains that it is missing (something from?) the libraries:
$sudo R CMD INSTALL sf_0.6-3.tar.gz
[...]
configure: pkg-config proj exists, will use it
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
configure: PROJ: 4.9.2
checking for pj_init_plus in -lproj... no
configure: error: libproj not found in standard or given locations.
ERROR: configuration failed for package ‘sf’
The same goes for using the install.packages("sf") command in R. I am using R version 3.5.0 on an Ubuntu 16.04 system, I managed to install the package on another computer with R version 3.4.3 but don't know what I did different to make it work then. Both apt and pkg-config --modversion proj say that the version is higher than needed (4.9.2) and i tried to find some info that could help me resolve the problem using pkg-config or on the internet but couldn't find anything. I did find the following line in /usr/include/proj_api.h (found using sudo apt-file search proj_api.h):
projPJ pj_init_plus(const char *);
which mentions the thing in the check not found, but I don't understand in what way it relates to this.
As a note, I do have two versions of R installed, I also have version 3.2.3 on the computer. Could this be a source of the problem? (I am sure, that the version I am installing the sf package to is 3.5)
EDIT
I have found another R package (proj4) with the libproj dependency and tried to install that one. While it did stop at the same error, this one gave a longer message:
>install.packages("proj4")
[...]
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
checking for pj_init_plus in -lproj... no
configure: error: libproj and/or proj_api.h not found in standard search locations.
*** Install PROJ.4 and if necessary set PKG_CPPFLAGS/PKG_LIBS accordingly.
ERROR: configuration failed for package ‘proj4’
The PKG_CPPFLAGS/PKG_LIBS variables? are not found in R, and echo $PKG_LIBS showed nothing either. Might there be a way I could set these so that the packages can be installed?
I am thankful for any tips or hints as to what causes this.
Peter
I think you may be using older versions of libgdal-dev and you
the following question could be the issue you are seeing
Rgdal installation failed on ubuntu 16.04
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install gdal-bin python-gdal python3-gdal libgdal1-dev

R Cairo package installation failed in Ubuntu 18.04

I attempt to install Cairo package in R under a Docker Ubuntu 18.04 container. Before installing the R Cairo package, I installed these packets in Ubuntu: libgtk2.0-dev, libcairo2-dev, xvfb, xauth, xfonts-base, r-base-dev, and libxt-dev.
However, when I installed Cairo package in R, I got the following error:
checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-lfreetype -lz -lpng16 -lz -lcairo -lXext -lXrender -lX11
checking for library containing deflate... no
checking whether Cairo programs can be compiled... configure: error: Cannot
compile a simple Cairo program. See config.log for details.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/opt/conda/lib/R/library/Cairo’
The downloaded source packages are in
‘/tmp/RtmprETcPh/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("Cairo") :
installation of package ‘Cairo’ had non-zero exit status
I've checked /tmp/RtmprETcPh/downloaded_packages, and there is only a filed called Cairo_1.5-9.tar.gz. And I don't know where to find config.log for more compile details of compiling a simple Cairo program.
Please help me to resolve out this issue if anybody know how to resolve out this issue.
Thank you
You may need to install the x11 dev libs since the docker container is likely not running these.
Try
sudo apt-get install libx11-dev
Under ubuntu 20.04, after installing libx11-dev, trying to install Cairo gave the error X11/Intrinsic.h not found. This is in libxt-dev. After installing this, Cairo could be installed.

How to install Rjags on Ubuntu

I am trying to install Rjags on Ubuntu, I have first installed this
sudo apt-get install JAGS
Then I have tried
R
install.packages("rjags")
I have the following error
> install.packages("rjags")
Installing package into ‘/home/louis/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 71719 100 71719 0 0 46062 0 0:00:01 0:00:01 --:--:-- 46032
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/bin/pkg-config
configure: Setting compile and link flags according to pkg-config
configure: Compile flags are -I/usr/include/JAGS
configure: Link flags are -ljags
checking for gcc... x86_64-conda_cos6-linux-gnu-cc
checking whether we are using the GNU C compiler... no
checking whether x86_64-conda_cos6-linux-gnu-cc accepts -g... no
checking for x86_64-conda_cos6-linux-gnu-cc option to accept ISO C89... unsupported
checking for jags_version in -ljags... no
configure: error: "cannot link to JAGS library in /usr/lib."
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/charlie/R/x86_64-pc-linux-gnu-library/3.4/rjags’
The downloaded source packages are in
‘/tmp/Rtmp9yfeon/downloaded_packages’
Warning message:
In install.packages("rjags") :
installation of package ‘rjags’ had non-zero exit status
I don't know how to solve this issue, thanks for your help
Andrey Kolyadin, I have followed your instruction, after installing I got this
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
r-cran-rjags
1 upgraded, 0 newly installed, 0 to remove and 296 not upgraded.
Need to get 88,6 kB of archives.
After this operation, 1 024 B of additional disk space will be used.
Get:1 http://ppa.launchpad.net/marutter/rrutter/ubuntu xenial/main amd64 r-cran-rjags amd64 1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1 [88,6 kB]
Fetched 88,6 kB in 1s (68,8 kB/s)
(Reading database ... 250343 files and directories currently installed.)
Preparing to unpack .../r-cran-rjags_1%3a4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1_amd64.deb ...
Unpacking r-cran-rjags (1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1) over (1:4-5-1) ...
Setting up r-cran-rjags (1:4.6-1cran4ubuntu1ppa1~ubuntu16.04.1~ppa1) ...
THen I have tried to call the library in R but it is not detected, unfortunately ...
If you installed it from the ppa suggested by andrey, remove it with
sudo apt-add-repository --remove ppa:marutter/rrutter
(Then) update your data:
sudo apt update
and then install it from the default
sudo apt install r-cran-rjags
Test it in R.
R
In R:
>library(rjags)
# Loading required package: coda
# Linked to JAGS 4.2.0
# Loaded modules: basemod,bugs
(probably redundant, just for SEO^^:) Works also for Linux Mint

Install rgl on R-Server Ubuntu

I want to to install rgl on R-Server, running on Ubuntu.
At the bas prompt I installed
sudo apt-get build-dep r-cran-rgl
Reading package lists... Done Building dependency tree Reading state
information... Done The following extra packages will be installed:
libglu1-mesa The following NEW packages will be installed:
libglu1-mesa r-cran-rgl 0 upgraded, 2 newly installed, 0 to remove and
0 not upgraded. Need to get 1,645 kB of archives. After this
operation, 3,875 kB of additional disk space will be used. Do you want
to continue? [Y/n] Y Get:1 http://archive.ubuntu.com/ubuntu/
trusty/main libglu1-mesa amd64 9.0.0-2 [195 kB] Get:2
http://archive.ubuntu.com/ubuntu/ trusty/universe r-cran-rgl amd64
0.93.996-1 [1,450 kB] Fetched 1,645 kB in 1s (1,047 kB/s) Selecting previously unselected package libglu1-mesa:amd64. (Reading database
... 55586 files and directories currently installed.) Preparing to
unpack .../libglu1-mesa_9.0.0-2_amd64.deb ... Unpacking
libglu1-mesa:amd64 (9.0.0-2) ... Selecting previously unselected
package r-cran-rgl. Preparing to unpack
.../r-cran-rgl_0.93.996-1_amd64.deb ... Unpacking r-cran-rgl
(0.93.996-1) ... Setting up libglu1-mesa:amd64 (9.0.0-2) ... Setting
up r-cran-rgl (0.93.996-1) ... Processing triggers for libc-bin
(2.19-0ubuntu6.6) ...
Thats it. The three points at the end do not indicate that there was more to copy. Then I logged in into R-Server and tried to run
install.packages("rgl", repos="http://R-Forge.R-project.org")
which resulted in an error, namely:
....
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers
checking GL/gl.h usability... no
checking GL/gl.h presence... no
checking for GL/gl.h... no
checking GL/glu.h usability... no
checking GL/glu.h presence... no
checking for GL/glu.h... no
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/clambio/R/x86_64-pc-linux-gnu-library/3.2/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpT5iyrb/downloaded_packages’
Any ideas what is going wrong?!
I solved this problem by installing
sudo apt-get install mesa-common-dev libglu1-mesa-dev
then install in R again:
install.packages("rgl")

Resources