Compiling R-4.1.0 with GNU

The R Project for Statistical Computing

Prerequisites

gnu-6.5
m4-1.4.18
gmp-6.1.0
mpfr-3.1.4
mpc-1.0.3
isl-0.18
gsl-2.1

Compiling PCRE is important or you will face an error like

configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support

After you have compile PCRE, you can proceed with the compilation of R-4.1.0

% ./configure --prefix=/usr/local/R-4.1.0 --with-pcre1=/usr/local/pcre-8.42 --with-blas --with-lapack --enable-R-shlib

If there are no issues….

R is now configured for x86_64-pc-linux-gnu

  Source directory:            .
  Installation directory:      /usr/local/R-4.1.0

  C compiler:                  gcc  -g -O2
  Fortran fixed-form compiler: gfortran  -g -O2

  Default C++ compiler:        g++ -std=gnu++14  -g -O2
  C++11 compiler:              g++ -std=gnu++11  -g -O2
  C++14 compiler:              g++ -std=gnu++14  -g -O2
  C++17 compiler:
  C++20 compiler:
  Fortran free-form compiler:  gfortran  -g -O2
  Obj-C compiler:              gcc -g -O2 -fobjc-exceptions

  Interfaces supported:        X11
  External libraries:          pcre1, readline, BLAS(generic), LAPACK(generic), curl
  Additional capabilities:     PNG, JPEG, NLS, ICU
  Options enabled:             shared R library, R profiling

  Capabilities skipped:        TIFF, cairo
  Options not enabled:         shared BLAS, memory profiling

  Recommended packages:        yes

Make and Make Install the Files

% make -j 8
.....
gcc -I"/home/user1/Downloads/R-4.1.0/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c anova.c -o anova.o
gcc -I"/home/user1/Downloads/R-4.1.0/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c anovapred.c -o anovapred.o
gcc -I"/home/user1/Downloads/R-4.1.0/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c branch.c -o branch.o
gcc -I"/home/user1/Downloads/R-4.1.0/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c bsplit.c -o bsplit.o
gcc -I"/home/user1/Downloads/R-4.1.0/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c choose_surg.c -o choose_surg.o
g
.....
% make install

References:

  1. Compiling R by Toby Dylan