Installation of package ‘Rmpfr’ had non-zero exit status in R

If you surf to Rmpfr part of the CRAN repository, you will notice that this package requires gmp and mpfr as system requirements installed prior to installing the R package.

What worked for me on Fedora 30 was that I made sure that I had the -devel versions installed, so:

sudo dnf install gmp-devel mpfr-devel

First I tried installing the package:

$ R

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("Rmpfr")
Installing package into ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘gmp’

trying URL 'https://cran.wu.ac.at/src/contrib/gmp_0.5-13.5.tar.gz'
Content type 'application/x-gzip' length 133364 bytes (130 KB)
==================================================
downloaded 130 KB

trying URL 'https://cran.wu.ac.at/src/contrib/Rmpfr_0.7-2.tar.gz'
Content type 'application/x-gzip' length 626031 bytes (611 KB)
==================================================
downloaded 611 KB

* installing *source* package ‘gmp’ ...
** package ‘gmp’ successfully unpacked and MD5 sums checked
** using staged installation
creating cache ./config.cache
checking for __gmpz_ui_sub in -lgmp... no
configure: error: GNU MP not found, or not 4.1.4 or up, see http://gmplib.org
ERROR: configuration failed for package ‘gmp’
* removing ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6/gmp’
ERROR: dependency ‘gmp’ is not available for package ‘Rmpfr’
* removing ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6/Rmpfr’

The downloaded source packages are in
    ‘/tmp/RtmpstRn5N/downloaded_packages’
Warning messages:
1: In install.packages("Rmpfr") :
  installation of package ‘gmp’ had non-zero exit status
2: In install.packages("Rmpfr") :
  installation of package ‘Rmpfr’ had non-zero exit status

Installing gmp-devel

$ sudo dnf install gmp-devel
Last metadata expiration check: 0:59:19 ago on Tue 24 Dec 2019 09:44:08 AM CET.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                 Architecture                         Version                                         Repository                            Size
=========================================================================================================================================================================
Installing:
 gmp-devel                               x86_64                               1:6.1.2-10.fc30                                 fedora                               173 k
Installing dependencies:
 gmp-c++                                 x86_64                               1:6.1.2-10.fc30                                 fedora                                17 k

Transaction Summary
=========================================================================================================================================================================
Install  2 Packages

Total download size: 191 k
Installed size: 402 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): gmp-c++-6.1.2-10.fc30.x86_64.rpm                                                                                                   36 kB/s |  17 kB     00:00    
(2/2): gmp-devel-6.1.2-10.fc30.x86_64.rpm                                                                                                214 kB/s | 173 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    107 kB/s | 191 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                 1/1 
  Installing       : gmp-c++-1:6.1.2-10.fc30.x86_64                                                                                                                  1/2 
  Installing       : gmp-devel-1:6.1.2-10.fc30.x86_64                                                                                                                2/2 
  Running scriptlet: gmp-devel-1:6.1.2-10.fc30.x86_64                                                                                                                2/2 
  Verifying        : gmp-c++-1:6.1.2-10.fc30.x86_64                                                                                                                  1/2 
  Verifying        : gmp-devel-1:6.1.2-10.fc30.x86_64                                                                                                                2/2 

Installed:
  gmp-devel-1:6.1.2-10.fc30.x86_64                                                     gmp-c++-1:6.1.2-10.fc30.x86_64                                                    

Complete!

Ooops, not enough.

> install.packages("Rmpfr")
Installing package into ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘gmp’

trying URL 'https://cran.wu.ac.at/src/contrib/gmp_0.5-13.5.tar.gz'
Content type 'application/x-gzip' length 133364 bytes (130 KB)
==================================================
downloaded 130 KB

trying URL 'https://cran.wu.ac.at/src/contrib/Rmpfr_0.7-2.tar.gz'
Content type 'application/x-gzip' length 626031 bytes (611 KB)
==================================================
downloaded 611 KB

* installing *source* package ‘gmp’ ...
** package ‘gmp’ successfully unpacked and MD5 sums checked
** using staged installation
creating cache ./config.cache
checking for __gmpz_ui_sub in -lgmp... yes
updating cache ./config.cache
creating ./config.status
creating src/Makevars
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I/usr/local/include/    -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -c apply.cc -o apply.o
...
checking mpfr.h presence... no
checking for mpfr.h... no
configure: error: Header file mpfr.h not found; maybe use --with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
* removing ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6/Rmpfr’

The downloaded source packages are in
    ‘/tmp/Rtmpaz2MNH/downloaded_packages’
Warning message:
In install.packages("Rmpfr") :
  installation of package ‘Rmpfr’ had non-zero exit status

Installing mpfr-devel.

$ sudo dnf install mpfr-devel
Fedora Modular 30 - x86_64                                                                                                                21 kB/s |  23 kB     00:01    
Fedora Modular 30 - x86_64 - Updates                                                                                                      32 kB/s |  22 kB     00:00    
Fedora 30 - x86_64 - Updates                                                                                                              28 kB/s |  22 kB     00:00    
Fedora 30 - x86_64                                                                                                                        18 kB/s |  23 kB     00:01    
google-chrome-beta                                                                                                                        16 kB/s | 1.3 kB     00:00    
google-chrome                                                                                                                            3.4 kB/s | 1.3 kB     00:00    
RPM Fusion for Fedora 30 - Free - Updates                                                                                                 61 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 30 - Free                                                                                                           12 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree - Steam                                                                                                54 kB/s | 9.6 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree - Updates                                                                                              51 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 30 - Nonfree                                                                                                        61 kB/s |  11 kB     00:00    
Dependencies resolved.
=========================================================================================================================================================================
 Package                                   Architecture                          Version                                     Repository                             Size
=========================================================================================================================================================================
Installing:
 mpfr-devel                                x86_64                                3.1.6-4.fc30                                fedora                                 76 k

Transaction Summary
=========================================================================================================================================================================
Install  1 Package

Total download size: 76 k
Installed size: 122 k
Is this ok [y/N]: y
Downloading Packages:
mpfr-devel-3.1.6-4.fc30.x86_64.rpm                                                                                                       283 kB/s |  76 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                     66 kB/s |  76 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                 1/1 
  Installing       : mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                  1/1 
  Running scriptlet: mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                  1/1 
  Verifying        : mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                  1/1 

Installed:
  mpfr-devel-3.1.6-4.fc30.x86_64                                                                                                                                         

Complete!

Trying again

> install.packages("Rmpfr")
Installing package into ‘/home/romunov/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cran.wu.ac.at/src/contrib/Rmpfr_0.7-2.tar.gz'
Content type 'application/x-gzip' length 626031 bytes (611 KB)
==================================================
downloaded 611 KB

* installing *source* package ‘Rmpfr’ ...
** package ‘Rmpfr’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc -m64
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 accepts -g... yes
...
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rmpfr)

The downloaded source packages are in
    ‘/tmp/Rtmp4K9VTv/downloaded_packages’