Clang issues when installing the igraph R package on Mac OS - r

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?

Related

Ubuntu 14.04 configure: error: "libxml not found"

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.

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.

Install R cairo package after installing cairo via conda

I'm trying to install the Cairo package for R. I don't have admin rights for the server so I installed Cairo via the conda package manager conda install -c https://conda.anaconda.org/anaconda cairo. I have compiled R from source in my home directory.
I have tried to add the following to my bashrc:
export CAIRO_LIBS=-L${HOME}/miniconda/pkgs/cairo-1.12.18-6/lib/cairo/
export CAIRO_CFLAGS=-I${HOME}/miniconda/pkgs/cairo-1.12.18-6/include/cairo/
When I try install.packages('Cairo'), I get the following error:
configure: CAIRO_CFLAGS=-I/N/u/jfreimer/Mason/miniconda/pkgs/cairo-1.12.18-6/include/cairo/
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=-L/N/u/jfreimer/Mason/miniconda/pkgs/cairo-1.12.18-6/lib/cairo/
checking for library containing deflate... -lz
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 ‘/N/home/j/f/jfreimer/Mason/R/lib64/R/library/Cairo’
Anaconda has an R package of cairo (https://anaconda.org/r/r-cairo) so all of the dependencies that I need should be installable via conda. However, I am trying to use the standalone R that I installed and not conda R as I have had trouble with other packages in conda R. I was wondering if anyone has any suggestions
try:
R -e "install.packages('cairo')" --configure-vars=
"CAIRO_CFLAGS=/PATH_TO_CAIRO/include/cairo;
CAIRO_LIBS=/PATH_TO_CAIRO/lib/cairo"
This work for me.
I had similar issues. I solved it by simply uninstalling and re-installing.
Open up R in the terminal console:
R
Uninstall Cairo
remove.packages("Cairo")
Re-install:
install.packages("Cairo")

Cabal-install error: /usr/bin/ld cannot find -lHSparsec-3.1.7-ghc7.8.3

I have an old version of cabal-install so I downloaded cabal-install 1.20 and When installing it errors out.
Additional note: ghc 7.8.3
OS: CentOS 6.6
Error:
Building network-2.4.2.3...
.......
......
......
usr/bin/ld: cannot find -lHSparsec-3.1.7-ghc7.8.3
collect2: ld returned 1 exit status
error during cabal-install bootstrap:
building the network package failed.
When I try to run "cabal install network-2.5.0.0",getting following errors
root#gains: cabal install network-2.5.0.0
Resolving dependencies...
Configuring network-2.5.0.0...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
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... configure: error: in `/tmp/network-2.5.0.023068/network-2.5.0.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
cabal: Error: some packages failed to install:
network-2.5.0.0 failed during the configure step. The exception was:
ExitFailure 1
Error :
checking whether we are cross compiling... configure: error: in `/tmp/network-2.5.0.023068/network-2.5.0.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
So, I run command yum groupinstall "development tools", installed c compiler tools and could compile c programs. Then,
checking whether we are cross compiling... configure: error: in /tmp/network-2.5.0.023068/network-2.5.0.0':
I tried mount -o remount,exec,suid /tmp which solved the error.Its because of execution rights issue on the file system.

Can't get RQuantLib working with brew installed quantlib under osx 10.9.4

I've been trying to install RQuantLib package via
install.packages("RQuantLib")
It keeps giving me the following errors
* installing *source* package ‘RQuantLib’ ...
** package ‘RQuantLib’ successfully unpacked and MD5 sums checked
checking for g++... g++
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 g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... no
configure: error: Boost development files not found
ERROR: configuration failed for package ‘RQuantLib’
* removing ‘/usr/local/Cellar/r/3.1.1/R.framework/Versions/3.1/Resources/library/RQuantLib’
I've already done
brew install boost
brew install quantlib
and I've checked the sym links for both, which should be fine (done unlink/link for both).
SOLUTION :
Used the command below based on edd's answer, worked for me
install.packages("RQuantLib", configure.args="--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/")
Try to do it either in a shell based on the *.tar.gz file using these
edd#max:~/git/rquantlib(master)$ ./configure --help|grep boost
--with-boost-include=INCLUDE_PATH
--with-boost-lib=LIB_PATH
edd#max:~/git/rquantlib(master)$
or look at the help for install.packages() where you can pass arguments to configure as well -- I find the first method easier.
In essence, it seems that we need to help configure find your Boost headers (and then probably also the library).

Resources