Error related to compilation when using install.packages - r

I am using R 3.3.3 on raspbian. I'm trying to install packages, and most have worked with no problem. However, when I try to install lubridate it fails and I get an extensive error message. The following part caught my attention:
#error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
I haven't been able to find how to add these compiler options. Any ideas/support would be appreciated.

The solution was to update the compiler by running sudo apt-get install g++

Related

Error when compiling R 3.6.1 on Ubuntu 18.04

I usually compile my own version of R, because I connect it to openmpi, and blas and a couple of other things. This configure statement appears to work fine
./configure --enable-R-shlib --with-blas=-lopenblas --enable-memory-profiling
but then when I try to make I get this error
gcc -Wl,--export-dynamic -fopenmp -L"../../lib" -L/usr/local/lib -o R.bin Rmain.o -lR
../../lib/libR.so: undefined reference to `ucol_strcollIter_58'
../../lib/libR.so: undefined reference to `u_getVersion_58'
which reading other threads appears to be related to the libicu-dev package? It appears to be looking for version 58, but I checked and currently have ubuntu version libicu-dev (60.2-3ubuntu3) installed. This might have something to do with a recent install of anaconda?
Reading package lists... Done
Building dependency tree
Reading state information... Done
libicu-dev is already the newest version (60.2-3ubuntu3).
libicu-dev set to manually installed.
Any suggestions how to get R to build against the newer installed version of libicu-dev?
I successfully install R with this commander "./configure --prefix=/path/to/location LDFLAGS="-L/usr/local/lib" . Where /usr/local/lib is the directory icu installed (wget https://github.com/unicode-org/icu/archive/release-58-3.tar.gz). I think it is the problem that anaconda/lib also contained libicuio.so.* files. After specifying certain LDFLAGS, it worked

Why is Rpy2 not installing in my OSX Sierra terminal?

I have seen a number of different people post this problem (example: Tried to guess R's HOME but no R command in the PATH. OsX 10.6 and Installing rpy2 on Mac OSX 10.8.5), but I have yet to find a viable solution.
I have ensured that I have Python-2.7 installed in my terminal, and since I had recently upgraded by RStudio, I thought that my R was also updated. But everytime I tried to run either:
pip install rpy2
or
easy_install rpy2
I kept getting the same error of Error: Tried to guess R's HOME but no command 'R' in the PATH.
After some googling, I decided to try to download the latest version of R (v 3.4.1), even though I'm very certain it was already updated to begin with. But now I get the following behemoth of an error (I should note that I have condensed it):
In file included from ./rpy/rinterface/_rinterface.c:122:
./rpy/rinterface/sequence.c:2173:1: warning: unused function 'ComplexVectorSexp_AsSexp' [-Wunused-function]
ComplexVectorSexp_AsSexp(PyObject *pyfloat) {
^
11 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/./rpy/rinterface/_rinterface.o -L/usr/local/lib -Lbuild/temp.macosx-10.12-intel-2.7 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.12-intel-2.7/rpy2/rinterface/_rinterface.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-zT8DaX/rpy2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bDnbE5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-zT8DaX/rpy2/
So now I have a completely different error occurring. I thought that upgrading my R would automatically add it to my environmental variable PATH, but now I'm really at a loss at how to deal with this. I have tried to google this new error but I can't seem to find any solutions that are geared towards installing Rpy2 on a Mac OSX with Python-2.7 and R-3.4. Can anybody offer any kind of advice?
ADDENDUM
I have now tried a variety of other approaches, including downloading XCODE, and updating my GCC compiler, (one such approach is delineated in http://cs.millersville.edu/~gzoppetti/InstallingGccMac.html), and I have also tried to reinstall GCC with the command brew reinstall gcc --without-multilib. I have also edited my PATH environmental variables to include R, CC, and have still had no luck.
I have now figured out that rpy2 installation is contingent upon the right kind of compiler being used. The default compiler for Apple is clang, which does not support rpy2's set up process. So, after acquiring the gcc compiler via homebrew, you can then run brew ls gcc to see the file paths of what gcc compilers are present on your computer. I then ran the following commands in the terminal to change the default compiler from clang to the file path gcc-7, then set the proper flags (which I deduced from reading the error messages yielded by the compiler before), and then install rpy2.
export CC=/usr/local/Cellar/gcc/7.2.0/bin/x86_64-apple-darwin16.7.0-gcc-7
export CFLAGS="-W"
pip install rpy2==2.8.6
I should note that I installed rpy2 version 2.8.6 since my scripts are in Python 2.7, and rpy2 2.9.0 is only compatible with Python 3.x. Furthermore, I am aware that this answer might not adequately describe the problem for everyone, so I encourage other users to expand and/or correct this solution.
The error about "no R in the PATH" is exactly about what it says. To reproduce, open a terminal and enter "R": there should not be any such command found. The solution is to have R findable in the PATH.
Now starting with R-3.4 the tools needed to compile R and and R extensions in C have changed, and the requirements are less standard than one might hope for. This can be debated to be an issue with R and OS X, and there is an open issue in the rpy2 tracker about it.
edit: Note that the issue was resolved and a precompiled binary wheel for rpy2-2.9.3 is now available on pypi.
It's possible to do the GCC switch with a single env command:
env CC=/usr/local/Cellar/gcc/7.2.0/bin/gcc-7 pip install rpy2
The reason clang doesn't work with RPy2 is because clang 4.0.0 doesn't include the -fopenmp flag, which is used by R. There's an ongoing open problem thread on the RPy2 Bitbucket about it.

gcc error installing R packages in ubuntu 16.04

I'm getting a gccerror while trying to install several R packages for example devtools and plyr give the same errors.
gcc: error: unrecognized command line option '-fstack-protector-strong'
gcc: error: unrecognized command line option '-Wdate-time'
/usr/lib/R/etc/Makeconf:132: recipe for target 'devtools.o' failed
I'm using ubuntu 16.04 and R: 3.3.2. I had a working version of R but there were issues with some libraries, so I did:
apt-get remove r-base-core and followed this to re-install
It would be great to get a set of instructions to re-install R if needed and fix the gcc error.
BTW: I also had an anaconda version, that I've removed.
EDIT:
$ gcc --version
gcc (Ubuntu 4.8.5-4ubuntu2) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
In case anyone gets this again, the simplest solution was to upgrade gcc to gcc.4.9.
Then everything works as expected.

configure error installing R-3.3.2 on Ubuntu: checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required

Trying to install R-3.3.2 but when I use $./configure, I keep getting the error:
checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required
It worked for me after:
sudo apt-get install libbz2-dev
I have successfully compiled R from source, the following steps need special attention:
install dependent libraries:
zlib-1.2.8, bzip2-1.0.6, xz-5.2.2, pcre-8.39, curl-7.52.1.
Specifically, to compile bzip2, The Makefile should be modified:
original: CC=gcc
after modification: CC=gcc -fPIC
pass the library and header file to the configure with proper variables:
export CPATH=/opt/zlib-1.2.8/include/:/opt/bzip2-1.0.6/include/:/opt/xz-5.2.2/include/:/opt/pcre-8.39/include/
export LD_LIBRARY_PATH=/opt/zlib-1.2.8/lib/:/opt/bzip2-1.0.6/lib/:/opt/xz-5.2.2/lib/:/opt/pcre-8.39/lib/
./configure --prefix=/opt/R/R_soft/ --enable-R-shlib --with-libpth-prefix=/opt/ CPPFLAGS="-I/opt/bzip2-1.0.6/include/ -I/opt/zlib-1.2.8/include/ -I/opt/xz-5.2.2/include/ -I/opt/pcre-8.39/include/ -I/opt/curl-7.52.1/include/" LDFLAGS="-L/opt/xz-5.2.2/lib/ -L/opt/zlib-1.2.8/lib/ -L/opt/bzip2-1.0.6/lib/ -L/opt/pcre-8.39/lib/ -L/opt/curl-7.52.1/lib/"
It seems CPATH and CPPFLAGS is redundant here, I found the CPPFLAGS AND LDFLAGS not worked.
First off, are you aware that you can get prebuilt binaries of current R ?
Second, your comment on the bzip2 binary has no bearing on the need for the library R needs to compile and link against.
Third, you can search: apt-cache search bzip2 | grep library would have gotten you there.
Fourth, for all existing packages you can actually install their known build dependencies. But see point one, you probably do not want to build from source.
Fifth, and closing: sudo apt-get install libbz2-dev answers your (narrow) question but you will likely have further issues. There is an entire manual devoted to installing and administering R which has all the answers for you.

Gcc-Ada configuration error

I downloaded gcc-ada-4.3.4.tar.gz when configure gave an error configure: error: cannot find install-sh or install.sh in . ./.. ./..
gcc version=4.3.4 using fedora16
On Fedora 16 you can do yum install gcc-gnat. This will install the appropriate GNAT version for your system.
If you really want to build it yourself, you have to install all dependencies first. You can find them easily.

Resources