R: Compiling issue - r

I want to compile the R source code on my own.
In order to this, I have installed all the required packages and two more with these commands
sudo apt-get build-dep r-recommended
sudo apt install libicu-dev gobjc-5
Then, I run the usual commands to configure with two additional options
./configure --enable-R-shlib --with-ICU
Until now everything ok, but when I tried to compile with the make command and at a certain point I got these error messages
make[2]: Entering directory '/home/myuser/Downloads/R-3.2.3/src/library/Recommended'
begin installing recommended package MASS
Error in untar2(tarfile, files, list, exdir, restore_times) :
incomplete block on file
Makefile:51: recipe for target 'MASS.ts' failed
make[2]: *** [MASS.ts] Error 1
make[2]: Leaving directory '/home/myuser/Downloads/R-3.2.3/src/library/Recommended'
Makefile:39: recipe for target 'recommended-packages' failed
make[1]: *** [recommended-packages] Error 2
make[1]: Leaving directory '/home/myuser/Downloads/R-3.2.3/src/library/Recommended'
Makefile:77: recipe for target 'stamp-recommended' failed
make: *** [stamp-recommended] Error 2
I have searched online but I haven't been able to figure it out what causes that error.
Thanks in advance.
OS: Ubuntu 15.10 64bit

Briefly:
You probably need apt-get build-dep r-base to get build-dependencies, not apt-get build-dep r-recommended
Your error is from also trying to build recommended packages for which you need an additional download step as explained in the documention
So add --without-recommended-packages to the configure call.

Related

recipe for target 'runtime_ccall.o' failed in installing julia (llvm?)

I just downloaded and installed the latest version of linux mint, mate. I want to install julia again but I get an strange error during the installation of v1.3.0
(... lots of output)
/home/usr/julia/usr/include/llvm/Support/MathExtras.h:545:38: required from here
/home/usr/julia/usr/include/llvm/Support/MathExtras.h:189:16: error: ‘static_assert’ was not declared in this scope
Makefile:165: recipe for target 'runtime_ccall.o' failed
make[1]: *** [runtime_ccall.o] Error 1
Makefile:75: recipe for target 'julia-src-release' failed
make: *** [julia-src-release] Error 2
This is somehow strange, but it appears to be related to LLVM. In trying to update LLVM I typed
sudo apt-get update -y
sudo apt-get install -y llvm
But the error keeps showing... any idea what am I missing?

Error installing SP package on Linux Mint 19

I would like to know if anyone has the solution for the following SP package installation error in Linux Mint 19? Here's the error message.
/bin/bash: line 2: g++: command not found
/usr/share/R/share/make/shlib.mk:6: recipe for target 'sp.so' failed
make: *** [sp.so] Error 127
ERROR: compilation failed for package ‘sp’
Thanks, Kaio.
It seems you don’t have the g++ compiler.
Open a terminal window and try
sudo apt-get install g++
The other alternative which includes some common build libraries is
sudo apt-get install build-essencial
Then try to reinstall the R package.

Installing R 3.5.0 with --enable-R-shlib

I am trying to install R 3.5.0 from source with the flag --enable-R-shlib under Linux Mint. Configuring and installing it without the flag works fine, but RStudio requires the flag to be set. However, when running
./configure --enable-R-shlib
make
I get the error
/usr/bin/ld: CommandLineArgs.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
CommandLineArgs.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:177: recipe for target 'libR.so' failed
make[3]: *** [libR.so] Error 1
make[3]: Leaving directory '/home/hps/Downloads/R-3.5.0/src/main'
Makefile:135: recipe for target 'R' failed
make[2]: *** [R] Error 2
make[2]: Leaving directory '/home/hps/Downloads/R-3.5.0/src/main'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/hps/Downloads/R-3.5.0/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1
I tried setting the -fPIC flag as mentioned in the error message following the advice from [1]
CC="gcc -fPIC" ./configure --enable-R-shlib
to no avail, I still get the same error message.
[1] Passing a gcc flag through makefile
After adding these PPAs for Ubuntu, I was able to update R to 3.5.0 for my Linux Mint 17.3 Rosa.
sudo add-apt-repository ppa:marutter/rrutter3.5
sudo add-apt-repository ppa:marutter/c2d4u
sudo apt-get update
Ref: https://cran.r-project.org/bin/linux/ubuntu/
Edit: To compile from source, follow the suggestion here
sudo apt-get update
sudo apt-get build-dep r-base
wget https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz
tar -xvf R-3.5.0.tar.gz
cd R-3.5.0
./configure --enable-R-shlib
make
Just in case someone else runs into this problem.
The issue is the object files ".o" are already compiled without the -fpic option.
The proper solution is to remove the object files from the first build and recomplile:
make clean
./configure --enable-R-shlib
make -j 4
sudo make install
The -j 4 tells make to spawn four compile processes at a time. Adjust the number to match the number of processor cores.

Issues installing mxnet GPU R package for Amazon deep learning AMI

I am having trouble installing mxnet GPU for R on Amazon deep learning linux AMI. The environment variables are such a mess that it’s a nightmare for any non-expert sys-admin to figure out.
Step 1: install the ridiculous amount of missing/broken programs and R packages
sudo yum install R
sudo yum install libxml2-devel
sudo yum install cairo-devel
sudo yum install giflib-devel
sudo yum install libXt-devel
sudo R
install.packages("devtools")
library(devtools)
install_github("igraph/rigraph")
install.packages(‘DiagrammeR’)
install.packages(‘roxygen2’)
install.packages(‘rgexf’)
install.packages(‘influenceR’)
install.packages(‘Cairo’)
install.packages(“imager”)
Step 2: edit the config.mk file
cd /src/mxnet
cp make/config.mk .
echo "USE_BLAS=openblas" >>config.mk
echo "ADD_CFLAGS += -I/usr/include/openblas" >>config.mk
echo "ADD_LDFLAGS += -lopencv_core -lopencv_imgproc -lopencv_imgcodecs" >>config.mk
echo "USE_CUDA=1" >>config.mk
echo "USE_CUDA_PATH=/usr/local/cuda" >>config.mk
echo "USE_CUDNN=1" >>config.mk
*note even though the USE_CUDA_PATH is set, it STILL cannot find libcudart.so and needs to be linked in the make command (shown later)
Step 3: make new config file so make command can find libcudart.so
/etc/ld.so.conf.d/cuda.conf
add /usr/local/cuda-8.0/lib64
sudo ldconfig
note this was posted by nvidia but does absolutely nothing to help the make rpkg
Step 4: set up R directories
Rscript -e "install.packages('devtools', repo = 'https://cran.rstudio.com')"
cd R-package
Rscript -e "library(devtools); library(methods); options(repos=c(CRAN='https://cran.rstudio.com'));
install_deps(dependencies = TRUE)"
cd ..
step 5: make
cd /src/mxnet
sudo make -j8
Result:
make CXX=g++ DEPS_PATH=/home/ec2-user/src/mxnet/deps -C /home/ec2-user/src/mxnet/ps-lite ps
cd /home/ec2-user/src/mxnet/dmlc-core; make libdmlc.a USE_SSE=1 config=/home/ec2-user/src/mxnet/config.mk; cd /home/ec2-user/src/mxnet
make[1]: Entering directory /home/ec2-user/src/mxnet/dmlc-core'
make[1]:libdmlc.a' is up to date.
make[1]: Leaving directory /home/ec2-user/src/mxnet/dmlc-core'
make[1]: Entering directory/home/ec2-user/src/mxnet/ps-lite'
make[1]: Nothing to be done for ps'.
make[1]: Leaving directory/home/ec2-user/src/mxnet/ps-lite'
ar crv lib/libmxnet.a
*note, even when changing the config.mk file, the make command always returns ‘nothing to update’
Step 6: attempt to make rpkg
Cd /src/mxnet
Sudo make rpkg
Error:
Error: package or namespace load failed for ‘mxnet’:
.onLoad failed in loadNamespace() for 'mxnet', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/lib64/R/library/mxnet/libs/libmxnet.so':
libcudart.so.8.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
So it’s looking in a location that doesn’t exist: /usr/lib64/R/library/mxnet/libs/
When the file actually lives:
/home/ec2-user/src/mxnet/R-package/inst/libs/libmxnet.so
or
/home/ec2-user/src/mxnet/lib/libmxnet.so
What I’ve tried so far:
sudo LD_LIBRARY_PATH=/usr/local/cuda/lib64 make rpkg
This will fix the missing libcudart.so.8.0 issue but it is simply replace with:
libmklml_intel.so: cannot open shared object file: No such file or directory as well as the original ‘cannot find libmxnet.so
Also tried:
1. actually creating directories (/usr/lib64/R/library/mxnet/libs/) and then copying libmxnet.so there
Result: same error
adding /home/ec2-user/src/mxnet/R-package/inst/libs/ to the make command
sudo LD_LIBRARY_PATH=/home/ec2-user/src/mxnet/R-package/inst/libs make rpkg
Result: same error
a ridiculous amount of environment labels all of which failed:
export MXNET_HOME=/usr/lib64/R/library/mxnet/libs/
export MXNET_HOME=/usr/lib64/R/library/mxnet/libs/libmxnet.so
sudo ldconfig /usr/local/cuda/lib64
sudo ln -s /usr/lib64/R/library/mxnet/libs /usr/lib
sudo ln -s /usr/lib64/R/library/mxnet/libs/libmxnet.so /usr/lib
sudo ln -s /usr/local/lib/libmklml_intel.so /usr/lib
sudo ln -s /usr/local/lib/libiomp5.so /usr/lib
sudo ln -s /usr/local /usr/lib
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/libcudart.so.8.0
export LD_LIBRARY_PATH=/usr/lib64/R/library/mxnet/libs/libmxnet.so /usr/lib
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/targets/x86_64-linux/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/libcudart.so.8.0
In all ONE of these worked, because I briefly got mxnet R package working before it fell apart again. I’ve dropped 50+ hours into this installation, which, frankly is ridiculous. Tougher to install the software then it is to program an actual net....
I don’t have 5+ years of linux sys admin knowledge so if you’d like please be a bit more helpful then ‘fix environment variables.’ I can tell that’s obviously what’s wrong yet have no idea what ‘fix environment variables’ entails.
To top it off, even after successful install of the R package, it STILL won’t work until setting Rstudio server’s config file to: rsession-ld-library-path=/opt/local/lib:/usr/local/cuda/lib64
Did you try the following when running any sudo commands.
sudo -E make -j8
This means that it will preserve the env variables when running as superuser. You shouldn't have to add a new config file for the make to find the libraries. Just preserving the env variables using the above command should be enough.

Error in installing SimpleDB::Class

I try to install SimpleDB::Class from cpan as sudo cpan SimpleDB::Class. it needs a dependency Memcached::libmemcached. so i try to install it, but it have the following errors.
CCLD clients/memstat
CC tests/atomsmasher.o
CCLD tests/atomsmasher
CXX tests/tests_hashplus-hash_plus.o
./config/depcomp: line 611: exec: g++: not found
make[2]: *** [tests/tests_hashplus-hash_plus.o] Error 127
make[2]: Leaving directory `/home/vanitha/.cpan/build/Memcached-libmemcached-0.4406- Oq4Z_m/src/libmemcached'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/vanitha/.cpan/build/Memcached-libmemcached-0.4406- Oq4Z_m/src/libmemcached'
make: *** [install] Error 2
Unable to build libmemcached: Error running cd src/libmemcached && make install
Aborted.
No 'Makefile' created TIMB/Memcached-libmemcached-0.4406.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
could not read metadata file. Falling back to other methods to determine prerequisites
exec: g++: not found - this is the error
Try this first of all: sudo apt-get install g++

Resources