configure error installing R-3.3.2 on Ubuntu: chec

2019-03-15 01:20发布

问题:

Trying to install R-3.3.2 but when I use $./configure, I keep getting the error:

checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required

回答1:

I have successfully compiled R from source, the following steps need special attention:

  1. install dependent libraries: zlib-1.2.8, bzip2-1.0.6, xz-5.2.2, pcre-8.39, curl-7.52.1. Specifically, to compile bzip2, The Makefile should be modified: original: CC=gcc after modification: CC=gcc -fPIC

  2. pass the library and header file to the configure with proper variables:

    export CPATH=/opt/zlib-1.2.8/include/:/opt/bzip2-1.0.6/include/:/opt/xz-5.2.2/include/:/opt/pcre-8.39/include/

    export LD_LIBRARY_PATH=/opt/zlib-1.2.8/lib/:/opt/bzip2-1.0.6/lib/:/opt/xz-5.2.2/lib/:/opt/pcre-8.39/lib/

    ./configure --prefix=/opt/R/R_soft/ --enable-R-shlib --with-libpth-prefix=/opt/ CPPFLAGS="-I/opt/bzip2-1.0.6/include/ -I/opt/zlib-1.2.8/include/ -I/opt/xz-5.2.2/include/ -I/opt/pcre-8.39/include/ -I/opt/curl-7.52.1/include/" LDFLAGS="-L/opt/xz-5.2.2/lib/ -L/opt/zlib-1.2.8/lib/ -L/opt/bzip2-1.0.6/lib/ -L/opt/pcre-8.39/lib/ -L/opt/curl-7.52.1/lib/"

It seems CPATH and CPPFLAGS is redundant here, I found the CPPFLAGS AND LDFLAGS not worked.



回答2:

It worked for me after:

sudo apt-get install libbz2-dev


回答3:

First off, are you aware that you can get prebuilt binaries of current R ?

Second, your comment on the bzip2 binary has no bearing on the need for the library R needs to compile and link against.

Third, you can search: apt-cache search bzip2 | grep library would have gotten you there.

Fourth, for all existing packages you can actually install their known build dependencies. But see point one, you probably do not want to build from source.

Fifth, and closing: sudo apt-get install libbz2-dev answers your (narrow) question but you will likely have further issues. There is an entire manual devoted to installing and administering R which has all the answers for you.