总结无root安装R-3.6.1,其在安装过程中要依赖的库有zlib 、bzip、xz、prce、curl、libiconv。首先要保证依赖库的安装,如果没有添加环境变量,那么就在编译的时候添加路径,或者在编译之后改变Makeconf。
报错
configure: error: libcurl >= 7.22.0 library and headers are required with support for https
解决方法 (参考https://www.jianshu.com/p/edb234eed915)
wget https://curl.haxx.se/download/curl-7.65.0.tar.gz
tar -zxvf curl-7.65.0.tar.gz
cd curl-7.61.0/
./configure --prefix=$PWD
make
make install
# 由于没有root权限 手动将其所依赖的库加入
./configure --prefix=$HOME/Program/R-3.6.1 --enable-R-shlib LDFLAGS="-L/share/home/Galbraith/program/zlib-1.2.11/lib -L/share/home/Galbraith/program/bzip2-1.0.6/lib -L/share/home/Galbraith/program/xz-5.2.2/lib -L/share/home/Galbraith/program/pcre-8.41/lib -L/share/home/Galbraith/program/curl-7.65.3/lib -Wl,-rpath=/share/home/Galbraith/program/pcre-8.41/lib -Wl,-rpath=/share/home/Galbraith/program/xz-5.2.2/lib" CPPFLAGS="-I/share/home/Galbraith/program/zlib-1.2.11/include -I/share/home/Galbraith/program/zlib-1.2.11/include -I/share/home/Galbraith/program/xz-5.2.2/include -I/$HOME/Programme/pcre-8.40/include -I/share/home/Galbraith/program/curl-7.65.3/include"
make再报错
../../lib/libR.so: undefined reference to `libiconv'
../../lib/libR.so: undefined reference to `libiconv_close'
../../lib/libR.so: undefined reference to `_libiconv_version'
../../lib/libR.so: undefined reference to `libiconv_open'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:145: R.bin] Error 1
make[3]: Leaving directory '/share/home/Galbraith/program/R-3.6.1/src/main'
make[2]: *** [Makefile:136: R] Error 2
make[2]: Leaving directory '/share/home/Galbraith/program/R-3.6.1/src/main'
make[1]: *** [Makefile:28: R] Error 1
make[1]: Leaving directory '/share/home/Galbraith/program/R-3.6.1/src'
make: *** [Makefile:61: R] Error 1
解决方法(参考https://blog.csdn.net/hhq163/article/details/5864470)
打开Makeconf
vim Makeconf
# 找到LIBS=这一行将这一行修改为如下信息
LIBS = -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -liconv 中加入-liconv
make clean & make又报错
cannot find -liconv
解决方法 安装libiconv(参考https://github.com/smparkes/zxing.rb/issues/3)
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar -zxvf libiconv-1.16.tar.gz
cd libiconv-1.16
./configure --prefix=$PWD
make
make install
#打开Makeconf ,在LDFLAGS中加入libiconv的路径,根据先前第一个报错时的经验,直接修稿Makeconf ,将libiconv的路径加入到LDFLAGS中
> LDFLAGS = -L/share/home/Galbraith/program/zlib-1.2.11/lib -L/share/home/Galbraith/program/bzip2-1.0.6/lib -L/share/home/Galbraith/program/xz-5.2.2/lib -L/share/home/Galbraith/program/pcre-8.41/lib -L/share/home/Galbraith/program/curl-7.65.3/lib -L/share/home/Galbraith/program/libiconv-1.16/lib -Wl,-rpath=/share/home/Galbraith/program/pcre-8.41/lib -Wl,-rpath=/share/home/Galbraith/program/xz-5.2.2/lib -Wl,-rpath=/share/home/Galbraith/program/libiconv-1.16/lib
网友评论