How do I install rJava properly on MX Linux - r

I am trying to install rJava, as it's a dependency of OpenStreetMap (I want to create some maps).
However, when trying to install, I get the following error:
/usr/bin/ld: cannot find -lpcre2-8
collect2: error: ld returned 1 exit status
make[2]: Leaving directory '/tmp/RtmplfpzAZ/R.INSTALL2958202af052/rJava/jri/src'
make[2]: *** [Makefile.all:35: libjri.so] Error 1
make[1]: Leaving directory '/tmp/RtmplfpzAZ/R.INSTALL2958202af052/rJava/jri'
make[1]: *** [Makefile.all:19: src/JRI.jar] Error 2
make: *** [Makevars:14: jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/home/maanan/R/x86_64-pc-linux-gnu-library/4.0/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpRkgFko/downloaded_packages’
Could someone please tell me what I did wrong? I have JDK and JRE installed.
Thanks.

apt install libpcre2-8-0 libpcre2-dev
That will (should) get you past the error at the very top. Of course I don't know what else you might be missing. Please google future errors you may get ...

Related

Unable to install package "quanteda.textstats" in R under Ubuntu 22.04.1 LTS

I am trying to install the package quanteda.textstats in R under Ubuntu Version 22.04.1 LTS.
I initially ran:
install.packages("quanteda.textstats")
where I got an error message saying it could not install the dependency proxyC. I was able to install that, but I still get an error message when running the above code.
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: quanteda.textstats.so] Error 1
ERROR: compilation failed for package ‘quanteda.textstats’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.2/quanteda.textstats’
Warning in install.packages :
installation of package ‘quanteda.textstats’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpuUtAq1/downloaded_packages’
I would guess I am missing certain dependencies, but I am unable to figure out what -llapack and -lblas stands for.
I also tried running the github install (option 3):
remotes::install_github("quanteda/quanteda.textstats")
but there as well I get a similar error:
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: quanteda.textstats.so] Error 1
ERROR: compilation failed for package ‘quanteda.textstats’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.2/quanteda.textstats’
Warning message:
In i.p(...) :
installation of package ‘/tmp/RtmpuUtAq1/file17581cc7f39c/quanteda.textstats_0.96.tar.gz’ had non-zero exit status
Can anybody help please?
Your are trying to compile the package which requires to have certain system dependencies installed, in this case lblas and llapack. This is not the recommended way to install R packages on Ubuntu. Instead you should install them as PPAs as described on CRAN.
If you insist on compiling the package yourself, install the dependencies via apt in the system terminal:
sudo apt-get install libblas-dev liblapack-dev

problem installing ComplexHeatmap. ERROR: compilation failed for package ‘cluster’

i am installing an R package called complex heatmaps (https://jokergoo.github.io/ComplexHeatmap-reference/book/). I get this error. So far i just identified it might be do to this package : https://packages.debian.org/buster/r-cran-cluster but i am not sure what to do at all. Thats why i am writing you.
Thanks a lot for your help
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'cluster.so' failed
make: *** [cluster.so] Error 1
ERROR: compilation failed for package ‘cluster’
* removing ‘/home/luca/R/x86_64-pc-linux-gnu-library/3.6/cluster’
Error: Failed to install 'ComplexHeatmap' from GitHub:
(converted from warning) installation of package ‘cluster’ had non-zero exit status
The error message indicates that you are missing libfortran.so. You might even miss more tools necessary for installing R packages from source. How to install this depends on the Linux distribution you are using. For Debian, which you mention in the question, this would be
sudo apt install r-base-dev
If you want to speed up package installation, you can also use the binary packages available in Debian, i.e.
sudo apt install r-cran-cluster

Package fracdiff of R fails to install in Linux Mint

I am installing the package forecast. However, I get a persistent error because the package fracdiff fails with this error:
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'fracdiff.so' failed
make: *** [fracdiff.so] Error 1
ERROR: compilation failed for package ‘fracdiff’
* removing ‘/home/mario/R/x86_64-pc-linux-gnu-library/3.4/fracdiff’
Warning in install.packages :
installation of package ‘fracdiff’ had non-zero exit status
Normally, when I see had non-zero exit status, it is for me a clue telling me that I should go to Synaptic and search for the library r-cran-fracdiff. However, this library is not present in my repositories, and don't really know how to solve this issue.
Any idea?
"/usr/bin/ld: cannot find -lXXX" tells you that you should be looking for a library named something like "libXXX-dev".
In this case I would install libblas-dev and perhaps also liblapack-dev, as explained here.

Installing rJava - ld: library not found for -lomp clang-4.0: error: linker command failed with exit code 1

I've been trying to troubleshoot installation of rJava in R (3.4.2) on my Mac OS Sierra 10.12.6. I've followed the advice I've found about OpenMP issues (http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/). The error I'm getting now, though, identifies the library not found as '-lomp' instead of '-fopenmp.' I'm not sure how to proceed from here.
Here's what it looks like when it hits the error:
ld: library not found for -lomp
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/y_/0bm1vdx95dn4m8x_xtctp2gh0000gn/T/RtmpfslTnc/downloaded_packages’
I had the same issue, and fixed it by creating a link to the library (libomp.dylib) in a directory where it can be found (/usr/local/lib/), as explained here.
Take a look here for full description of how to compile most recent Java inside OSX.
Note that you need clang with omp support - it is not available directly from Apple: http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/
You need to:
get clang from llvm page
configure R to use JDK of your choice
compile rJava from sources

Compilation fails when trying to install "pcalg" for R on El Capitan

When trying to install the pcalg package, I am getting the following error:
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pcalg.so] Error 1
ERROR: compilation failed for package ‘pcalg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/pcalg’
The downloaded source packages are in
‘/private/var/folders/54/nwpr9hkn49b1m4h3hjmwph6r0000gn/T/RtmpREqD5T/downloaded_packages’
Warning message:
In install.packages("pcalg") :
installation of package ‘pcalg’ had non-zero exit status
I'm assuming this is because the gfortan package now in gcc, but I don't know how to point it to the right place. Does anybody know how to fix this?

Resources