Error installing SP package on Linux Mint 19 - r

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.

Related

Installing systemfonts package from CRAN and GitHub fails

I recently upgraded my intel MacBook from Catalina to Monterey (Darwin release 21.1.0) I also upgraded R from 4.0.1 to 4.1.1 via home-brew. I have reinstalled the majority of packages necessary for my work, however, ran into issues with mapview. It failed to install due to an issue with a dependency - systemfonts. I attempted to install systemfonts directly from CRAN and after that failed from GitHub which also failed with these messages:
/bin/sh: I/usr/local/Cellar/r/4.1.1_1/lib/R/include: No such file or directory
make: [mac/FontManagerMac.o] Error 127 (ignored)
and
clang: error: no such file or directory: 'mac/FontManagerMac.o'
make: *** [systemfonts.so] Error 1
ERROR: compilation failed for package ‘systemfonts’
* removing ‘/usr/local/lib/R/4.1/site-library/systemfonts’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/85/56q39hqj2_gf31m9mbln7hhw0000gn/T//RtmpJGiNgA/file324134b404c/systemfonts_1.0.3.9000.tar.gz’ had non-zero exit status
I'd appreciate any thoughts on this issue. I may open an issue on GitHub r-lib/systemfonts as this may be related to some sort of incompatibility between the package and the updated OS however, thought I should start here.
Thanks
The solution listed in the issue from #Kevin_Cazelles linked to worked on my computer. Seems like it has something to do with gcc and R's call for the compiler.
This worked for me:
brew reinstall gcc
brew link --overwrite gcc
and then this in R-studio terminal
withr::with_makevars(c(OBJCXX = "gcc"), install.packages('systemfonts'))
In the bash shell:
sudo apt install libfontconfig1-dev
in RStidio
install.packages("systemfonts", dependencies = TRUE)

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?

Unable to install gmum.r package

I'am not able to install the R package gmum.r. It says compilation failed. I have installed all supporting packages.
/bin/bash: g++: command not found
make: *** [svm/libsvm_runner.o] Error 127
ERROR: compilation failed for package ‘gmum.r’
* removing ‘/home/XXX/R/x86_64-pc-linux-gnu-library/3.2/gmum.r’
It got worked using the following command,
sudo apt-get install r-base-dev
Errors fixed !

gcc error when installing Statnet package

Installing statnet on mac 10.10.3 with R 3.2.x (RStudio 0.99.441).
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [latentnet.so] Error 1
ERROR: compilation failed for package ‘latentnet’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/latentnet’
Warning in install.packages :
installation of package ‘latentnet’ had non-zero exit status
ERROR: dependency ‘latentnet’ is not available for package ‘statnet’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/statnet’
Warning in install.packages :
installation of package ‘statnet’ had non-zero exit status
I tried updating XCode/Command Line Tools. Also tried not installing dependencies. I have been able to install other packages, such as ergm and sna.
It looks like the install is looking for the GCC folder and not finding it.
whereis gcc
reveals that my gcc is in /usr/bin/gcc
It looks like the install is looking for it in /usr/local/lib/gcc/
Is there a way to fix this?
This is a compilation error that you only get if you are trying to install packages from source, or when a package requires a library to be compiled from source. Normally, if you don’t use the latest version of R, you can install statnet from binary and thus R won’t have to compile the source package.
The version you are mentioning at the beginning of your message (0.99.441) is the version of your R-Studio, and not R. The version of your R is 3.2.x (Hence its address in the Library folder: /Library/Frameworks/R.framework/Versions/3.2/Resources…). Before trying to fix the compilation error you may want to try to roll back your R to a version like 3.1.2 or 3.1.3 on which you can probably download and install statnet in binary format.
For the compiler, my guess is that even if you fix the address of your gcc with a symlink, you will still get an error about gfortran or the version of gcc. Once I solved this issue by installing R and the right version of gcc through Homebrew, but right now I don’t have the possibility to try the solution and tell you exactly how.
My experience (on Yosemite) is that if you use 3.1.2 or 3.1.3, even if there is need for compilation, the error with gcc won’t occur.
sudo mkdir /usr/bin/lib && sudo ln -s /usr/bin/gcc /usr/bin/lib/gcc
Creates a new directory in /usr/bin called `lib' and creates a symbolic link to gcc in that new directory.
If that doesn't fix the error, you can undo it with:
sudo rm -i /usr/bin/lib/gcc && sudo rm -id /usr/bin/lib

"Unable to compile a JNI program" when installing rJava [duplicate]

I am not able to call rJava package in R 3.0. I got the following message
Error: package ‘rJava’ was built before R 3.0.0: please re-install it
I am getting error when I tried to re-install rJava package. I have provided the output of R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.7.0_21
Java home path : /usr/lib/jvm/java-7-openjdk-i386/jre
Java compiler : /usr/lib/jvm/java-7-openjdk-i386/jre/../bin/javac
Java headers gen.: /usr/lib/jvm/java-7-openjdk-i386/jre/../bin/javah
Java archive tool: /usr/lib/jvm/java-7-openjdk-i386/jre/../bin/jar
trying to compile and link a JNI progam
detected JNI cpp flags :
detected JNI linker flags :
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O2 -pipe -g -c conftest.c -o conftest.o
conftest.c:1:17: fatal error: jni.h: No such file or directory
compilation terminated.
make: *** [conftest.o] Error 1
Unable to compile a JNI program
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib/R
Done.
I am using Ubuntu 13.04. I also tried apt-get install r-cran-rjava which is not helping to solve the issue. Regarding jni.h there were some solution here. But, not sure how can I use the solution here.
I ran into the exact same issue. My solution was to install the openjdk-7-* via
sudo apt-get install openjdk-7-*
Followed that with
sudo R CMD javareconf
and I was then able to install rJava in R via install.packages("rJava").
While perhaps not the most elegant solution it appears to have solved my problems with getting rJava to work.
For those getting the error:
error: unable to load shared object '/some/dir/rJava/libs/rJava.so': libjvm.so:
cannot open shared object file: No such file or directory
I solved the error locating the library in the system and linking them to /usr/lib:
$sudo updatedb
$locate libjvm.so
/usr/lib/debug/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libjvm.so
/usr/lib/debug/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/zero/libjvm.so
/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/jamvm/libjvm.so
/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libjvm.so
/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/zero/libjvm.so
$sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libjvm.so /usr/lib/
Installing rJava from the distribution packages as proposed in this askUbuntu answer also works:
sudo apt-get install r-cran-rjava
NOTE: tried from a Debian system.
I was also facing same error which was on RHEL8.1 & i resolved it as follows:
yum --enablerepo=* install java-1.8*
later i ran same command which was giving me error logs of R server.
R CMD javareconf
which turns into following output.

Resources