Compiling R-3.4.2 on CentOS 6 with GNU


If you are compiling CentOS 6, you will notice that the R source will not compile without a updated version of zlib, pcre, bzip2. libcurl. There is a very good site on how to compile R on Red Hat Linux

Step 1: Compile R-3.4.2

Download R-3.4.2 from The R Project for Statistical Computing

$ tar -zxvf R-3.4.2.tar.gz
$ ./configure --prefix=/usr/local/RH6_apps/R-3.4.2

During configuring…. error surfaced.

checking for zlib.h... yes
checking if zlib version >= 1.2.5... no
checking whether zlib support suffices... configure: error: zlib library and headers are required

Step 2: Compile zlib 1.2.11

a. In your .bashrc

export CFLAGS="-I/usr/local/zlib-1.2.11/include"
export LDFLAGS="-L/usr/local/zlib-1.2.11/lib"

b. Compile zlib-1.2.11

$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxvf zlib-1.2.11
$ cd zlib-1.2.11
$ configure --prefix=/usr/local/zlib-1.2.11

Step 3: Compile bzip2
a. Download the bzip2

$ wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
$ tar xzvf bzip2-1.0.6.tar.gz
$ cd bzip2-1.0.6

b. Compile bzip2

$ make -f Makefile-libbz2_so
$ make clean
$ make -n install PREFIX=/usr/local/R-3.4.2
$ make install PREFIX=/usr/local/R-3.4.2

Step 4: Compile liblzma or xz

$ wget http://tukaani.org/xz/xz-5.2.3.tar.gz --no-check-certificate
$ tar xzvf xz-5.2.3.tar.gz
$ cd xz-5.2.3
$ ./configure --prefix=/usr/local/xz-5.2.3
$ make -j8
$ make install

Step 5: Compile pcre-8.40

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
$ tar xzvf pcre-8.40.tar.gz
$ ./configure --prefix=/usr/local/pcre-8.40
$ make -j 8
$ make install

Step 6: Compile libcurl-7.47.1

$ wget  https://curl.haxx.se/download/curl-7.47.1.tar.gz --no-check-certificate
$ tar xzvf curl-7.47.1.tar.gz
$ cd curl-7.47.1
$ ./configure --prefix=/usr/local/curl-7.47.1
$ make -j 8
$ make install

Step 7: Update CFLAGS and LDFLAGS

export CFLAGS="-I/usr/local/zlib-1.2.11/include -I/usr/local/bzip2-1.0.6/include -I/usr/local/xz-5.2.3/include -I/usr/local/pcre-8.40/include -I/usr/local/curl-7.47.1/include/curl"
export LDFLAGS="-L/usr/local/zlib-1.2.11/lib -L/usr/local/bzip2-1.0.6/lib -L/usr/local/xz-5.2.3/lib -L/usr/local/pcre-8.40/lib -L/usr/local/curl-7.47.1/lib"

Step 8: Compile R-3.4.2

$ ./configure --enable-utf8 --prefix=/usr/local/R-3.4.2
$ make -j 8
$ make install

References:

  1. Building R-devel on RedHat Linux 6
This entry was posted in R. Bookmark the permalink.

5 thoughts on “Compiling R-3.4.2 on CentOS 6 with GNU

  1. Thank you very much for your post! It was a great help, but I had to do some things differently:

    – I could not get bzip2 from http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz. Instead, I cloned it from the GitHub repository at https://github.com/enthought/bzip2-1.0.6. I also changed the prefix in make install so that it would match the path for CFLAGS and LDFLAGS

    – I had some issues with the headers for pcre-8.40, so I configured it with the –enable-utf8 flag, as suggested here https://github.com/clemsonciti/r-installation-on-palmetto/blob/master/README.md. My problem was probably due to the fact that R was being configured with that flag but not pcre.

    Like

  2. checking whether zlib support suffices… configure: error: zlib library and headers are required

    i have above the issues please help me out

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.