rgmpinstall.packages

R gmp package installation fails; configure: error: Header file gmp.h not found


When trying to install the R gmp package, the installation fails because of the following error: configure: error: Header file gmp.h not found

the whole log:

> installing *source* package 'gmp' ...
> package 'gmp' successfully unpacked and MD5 sums checked
> using staged installation
> checking for gcc... gcc
> 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 accepts -g... yes
> checking for gcc option to accept ISO C89... none needed
> checking how to run the C preprocessor... gcc -E
> checking whether we are using the GNU C++ compiler... yes
> checking whether g++ -std=gnu++11 accepts -g... yes
> checking for grep that handles long lines and -e... /usr/bin/grep
> checking for egrep... /usr/bin/grep -E
> checking for ANSI C header files... yes
> checking for sys/types.h... yes
> checking for sys/stat.h... yes
> checking for stdlib.h... yes
> checking for string.h... yes
> checking for memory.h... yes
> checking for strings.h... yes
> checking for inttypes.h... yes
> checking for stdint.h... yes
> checking for unistd.h... yes
> checking gmp.h usability... no
> checking gmp.h presence... no
> checking for gmp.h... no
> configure: error: Header file gmp.h not found; maybe use --with-gmp-include=INCLUDE_PATH
> ERROR: configuration failed for package 'gmp'`

I found a lot of questions concerning finding the gmp.h file, but non were usable for my case because I am working on a remote server and I am not a root user, meaning I cannot just install whatever I want.

I tried the installation using both the terminal and the R shell but both gave the same error.


Solution

  • dnf install gmp-devel or apt-get install libgmp-dev worked for me