Installing systemfonts package from CRAN and GitHub fails - r

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)

Related

Cannot install nloptr (R 4.0.3, Ubuntu 20.04)

I tried to install nloptr on R 4.0.3, however I get this error:
/usr/bin/ld: /usr/local/lib/libnlopt.a(general.o): relocation R_X86_64_TPOFF32 against `nlopt_srand_called' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libnlopt.a(mt19937ar.o): relocation R_X86_64_TPOFF32 against `mti' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libnlopt.a(timer.o): relocation R_X86_64_TPOFF32 against `start_inited.4301' can not be used when making a shared object; recompile with -fPIC
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/home/giovanni/R/x86_64-pc-linux-gnu-library/4.0/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
Can someone point me to a solution?
Thanks in advance.
The latest (2.6.2) package of libnlopt-dev is broken in Ubuntu 20, for some reason it is compiled into a static library (.so shared object is missing)
I faced the similar problem a couple of days ago. The quick fix is to download NLOPT fron Github and compile it yourself
https://nlopt.readthedocs.io/en/latest/NLopt_Installation/
At least, it worked for me.
I had a slightly related issue with this package, apt install cmake which was suggested by cli itself fixed the issue.
I also failed to install the nloptr but had another error.
g++: error: nlopt/lib/libnlopt.a: No such file or directory
I followed others suggestion to install the nlopt first as described in nlopt website. The installation process was
mkdir build
cd build
cmake ..
make
sudo make install
But I found the cmake version which nlopt needed should be higher than 3. The default cmake in my computer was version 2.8.12.2 which was /usr/bin/cmake. So I installed cmake version 3.24.2 in my home directory and compiled the nlopt using absolute path of cmake as ~/software/install/cmake-3.24.2-linux-x86_64/bin/cmake ... And I used sudo to install the nlopt in the computer. I could see the libnlopt.so libnlopt.so.0 libnlopt.so.0.11.1 files in /usr/local/lib64
When I went back to install the nloptr in R. It still failed. I found the cmake failure in the output information of installation. So I add the cmake(version 3.24.2) to my PATH in .bashrc file and then I installed the nloptr successfully.

Problem to install package RMySQL / Ubuntu 18.04

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
When I try install the package RMySQL using the following command:
install.packages('RMySQL')
I got the following error message:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RMySQL.so' failed
make: *** [RMySQL.so] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/home/lepina/R/x86_64-pc-linux-gnu-library/3.6/RMySQL’
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
I ask help because I don't know what else I might to do. I have already performed a R downgrade from 4.0.0 to 3.6.3 without success.
Following the recommendation from Dirk Eddelbuettel, and I run the following command line:
sudo apt-get install r-cran-rmysql
But I get another error message:
:~$ sudo apt-get install r-cran-rmysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-cran-rmysql : Depends: r-api-3.4
Depends: r-cran-dbi (>= 0.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So I decided to fix the broken packages, using the couple of commands:
sudo apt update --fix-missing
sudo apt install -f
And forcing the manual installation of missing package r-api-3.4, using the command:
sudo apt-get install -y r-api-3.4
But I got another error message that I don't have ideia about how to solve it:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package r-api-3.4 is a virtual package provided by:
r-base-core 3.4.4-1ubuntu1 [Not candidate version]
E: Package 'r-api-3.4' has no installation candidate
To make it visible for everybody else: Dirk's solution via terminal worked for me (Ubuntu 22.04): sudo apt-get install r-cran-rmysql

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.

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

How to solve the error " missing required header GL/gl.h" while installing the Package mvoutlier in R?

I am trying to install the package mvoutlier but following error occurs during installation:
install.packages("mvoutlier")
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library /2.15/rgl’
ERROR: dependency ‘rgl’ is not available for package ‘compositions’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/compositions’
ERROR: dependency ‘compositions’ is not available for package ‘mvoutlier’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/mvoutlier’
After that I have install the rgl package successfully, then I tried to install the compositions package then the again same error occurs. Then I have again tried to install the mvoutlier package the same error occurs.
Can anyone let me know how I can resolve this problem. Thanking you in advance.
I suspect you are running Ubuntu 12.04.I think you're going to find that this works for the GL/gl.h problem:
install these at the regular old terminal, ie pretend R doesn't exist for now:
libglu1-mesa-dev freeglut3-dev mesa-common-dev
You might get the following error later (in R) because of a tcl b****/gripe/complaint:
Error in structure(.External(.C_dotTcl, ...), class = "tclObj") :
[tcl] can't find package BWidget.
To fix this problem, if you have it:
sudo apt-get install bwidget
These are not R problems. They are OS problems!
I ran into the same issue in between others on a Ubuntu based Linux distro (Linux Mint). Here I will share the worklog I'd done to fix it.
The full fix was:
apt-get install libx11-dev mesa-common-dev libglu1-mesa-dev
Worklog
The first error was related to missing devel libraries of X11:
configure: error: X11 not found but required, configure aborted.
I fixed it installing:
apt-get install libx11-dev
However, after fix the issue, I felt into a new one like this one:
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
I checked the library on the repository:
# dpkg -S /usr/include/GL/gl.h
dpkg-query: no path found matching pattern /usr/include/GL/gl.h
To fix this issue, install :
apt-get install mesa-common-dev
Then, I was prompt by a new error:
configure: error: missing required header GL/glu.h
To fix the issue, install the libglu1 devel libraries:
apt-get install libglu1-mesa-dev
configure: error: missing required header GL/gl.h
normally means you haven't installed the -dev version of a package, in this case GL.
On my system, GL/gl.h is owned by mesa-common-dev
$ dpkg -S /usr/include/GL/gl.h
mesa-common-dev: /usr/include/GL/gl.h
which would have been installed with apt-get install mesa-common-dev or via some GUI magic.
On Ubuntu 16.04, I solved this problem (during rgl package installation) with sudo apt-get install libglu1-mesa-dev
the current fedora package manager will fail to find these libraries as shown. Instead you need to do
sudo dnf install mesa-libGL-devel mesa-libGLU-devel
Based on the work breakdown by 3manuek, I figured only the libglu1-mesa-dev library was needed in ubuntu 16.04 LTS, and it worked.
On, RHEL, sudo yum install mesa-libGLU-devel worked.
I encountered an equivalent problem when testing a package that required 'rgl' on Travis. The problem is that the operating system lacks the necessary GL files on which the 'rgl' package draws.
A thread at R-forge offers the ingenious solution of running apt-get install r-cran-rgl, which will pull in any of the GL dependencies not already present on the operating system. This seems simpler than second-guessing which specific dependency is missing, and it remains possible to install a more recent version of 'rgl' if required.

Resources